View Full Version : OpenGL & Win32 Dialog Box
hey, I made a win32 dialog box and put a frame on it. In the WM_INITDIALOG message handler, I got the handle to the frame's window, got the size, and created an opengl context for it. It works sort of, because when I clear, the frame's background changes to my clear color, but I can't draw anything in it. I tried doing a GL_QUAD but I couldn't see it. Any suggestions?
05-29-2003, 04:48 AM
Check on my website, I've the example likes yours.
I appreciate the help, but after browsing through your website, you don't have an example of what I'm trying to do. Here's a look at what i'm trying to do:
[This message has been edited by Laz (edited 05-29-2003).]
05-30-2003, 04:31 AM
If it cleared, you probably got the OpenGL stuff initialized correctly. If your quad isn't being drawn, it could be due to any number of things. How did you setup your PROJECTION and MODELVIEW matrices? Where do you draw the Quad? One of the most likely reasons you don't see your quad is because you are drawing it outside of the viewing frustum. (e.g. in front of the near clip plane, behind the back clip plane, etc.)
05-30-2003, 05:04 AM
Check out chapter 3 of the red book. There is a section in it about debugging transformations, and it lists the most common causes of the "blank screen" effect. You can find it online with a Google search.
As far as I know, the rendering code is correct. I've had a few people look at it, but here it is in case you guys see any blatant errors that I missed:
// Function: DrawScene();
// Last Modified: April 07, 2003
// Purpose: Renders opengl things
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTranslatef(0.0f, 0.0f, -50.0f);
glColor3f(1.0f, 1.0f, 1.0f);
glVertex3f(-100.0f, 100.0f, 0.0f);
glVertex3f(-100.0f, -100.0f, 0.0f);
glVertex3f(100.0f, -100.0f, 0.0f);
glVertex3f(100.0f, 100.0f, 0.0f);
// Swap the buffers
I'm about to try something a bit different, so we'll see how that turns out. I'll post an update if I get it working. Thanks for the help guys. http://www.opengl.org/discussion_boards/ubb/smile.gif
05-30-2003, 04:01 PM
and how is your projection matrix set up? is the modelview matrix the identity when you call DrawScene()? if not, what is it? is lighting disabled?
// Set the Matrix mode
// Load the Identity Matrix
// Set the perspective
gluPerspective(35.0f, fAspect, 1.0f, 500.0f);
// Reset back to the Modelview Matrix so we can do some drawing
// Load the identity matrix ... again ...
As far as I know, I'm doing this correctly. I copied and pasted code from a previous applcation that worked fine. The only difference is the dialog box.
Oh my god, I'm an idiot. This whole time, I had nWidth set to rRect.left instead of rRect.right, so my aspect radio was always 0 (since rRect.left is 0 as well)
Thanks you guys, for the help. I'm going to go flush my head town a toilet now. http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.