Here’s my current dilemna. I have a dialog-based interface built in MFC using MSVC. In this interface, I have many buttons/text fields/etc. I have a small window in the interface that I would like to display 3-dimensional opengl scene. I can’t figure out how to get the damned opengl view to display it’s graphics, though. When I put breakpoints in my code in the rendering section, and then step through it, I can see the opengl scene I have built. Whenever I just run the program, though, I just get a blank spot where the opengl should be. Any suggestions are appreciated. If you post a link, please tell me what you’re linking.
The same opengl code works in another application. glClearColor does nothing when I’m not stepping through the program in the debugger.
I’m not sure how to do this.
The opengl window is placed inside a static text window and I use GetDlgItem to get the CStatic pointer which I pass to the constructor of the object that handles all the opengl stuff.
Currently, the dialog shows the first frame of my opengl test animation when I run it. I have a button that calls the OnPaint() method of my CDialog-derived window, which when pressed, does update the opengl view. So what I need to know is a way to force the update continuously.
You said that you see the first frame of your animation in the static text window…does it stay there? Or, does it disappear immediately?
Normally, when using OpenGL with a Windows window, you need to override the behavior of the OnEraseBackground handler to do nothing. The default behavior is that the window is cleared using GDI. The result is that your OpenGL-rendered scene is quickly overwritten by the GDI background clear. You would see a lot of flickering. There are many ways to overcome this. Since I’m not certain that this is your issue, I won’t go into that yet.
Also, if you want the animation to automatically increment through the frames, set a timer on the window to cause the animation to go forward.
another possibility may be to set the clibsiblings and clipchildren styles in the dialog properties. since opengl requires these styles in a windowed application, i can’t see any reason why a dialog-based app wouldn’t either.
Well, as of yesterday around 16:30 CST, I got OpenGL working in my interface. Thanks for your help everybody.