View Full Version : Dialog-based Interface
07-02-2001, 12:25 PM
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.
07-02-2001, 01:44 PM
1) Have you verified that these OpenGL functions work outside of the dialong? Try using that CWnd as the main window of an application to see if the drawing functions are actually doing what they should. Or, try using glClearColor to change the color of the display to at least see if anything is being displayed by OpenGL.
2) Are you sure your initialization code is working properly? Are you getting a valid pixel format?
3) How do you go about putting that window in the dialog box?
07-03-2001, 05:09 AM
1. The same opengl code works in another application. glClearColor does nothing when I'm not stepping through the program in the debugger.
2. I'm not sure how to do this.
3. 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.
07-04-2001, 08:50 AM
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.
07-04-2001, 09:15 AM
Well, as of yesterday around 16:30 CST, I got OpenGL working in my interface. Thanks for your help everybody.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.