Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

blue_fireball01

OpenGL OpenGL Init & SERIOUS Window BUG

This topic is 6359 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My application creates a Window and then calls a function called OpenGLInit() that is supposed to do all init work and for some VERY odd reason the Windowed 640x480(Run on 800x600) program appears to go full screen when it hits the OpenGL and it seems that the system is frozen(Though if WinAmp is playing it continues). Could anyone help me out? int InitOpenGL() { GLuint PixelFormat; HDC DC; static PIXELFORMATDESCRIPTOR pfd= { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; if (!(DC=GetDC(Wnd))) { return FALSE; } if (!(PixelFormat=ChoosePixelFormat(DC,&pfd))) { return FALSE; } if(!SetPixelFormat(DC,PixelFormat,&pfd)) { return FALSE; } if (!(RC=wglCreateContext(DC))) { return FALSE; } if(!wglMakeCurrent(DC,RC)) { return FALSE; } ShowWindow(Wnd,SW_SHOW); SetForegroundWindow(Wnd); SetFocus(Wnd); if (sheight==0) // Prevent A Divide By Zero By { sheight=1; // Making Height Equal One } width=swidth; height=sheight; glViewport(0,0,swidth,sheight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.5f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); return 1; }

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
if you set the pixel format, it will go fullscreen.

As for the application freezing, I''d bet it''s because your rendering loop does nothing (maybe clear the screen). So you''re basically taking all the CPU resources

Share this post


Link to post
Share on other sites
That''s very odd....... In NeHe''s tutorials it doesn''t go fullscreen even when setting the pixel format........
Also my program is supposed to quit when Escape is pressed.......

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
oops I''m sorry!

I meant if you call "ChangeDisplaySettings()", it will go fullscreen. So make sure you don''t call it when trying to go in windowed mode.

Share this post


Link to post
Share on other sites
Of course I didn''t! Though I deceided to try letting it operate fullscreen and added that in and so it changed the display mode before creating the window and went fullscreen and then same as before no input and no drawing by OpenGL(It''s supposed to draw primitives when idle).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Does it have anything to do with PFD_DOUBLEBUFFER ?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster

Just because you requested a certain pixelformat by calling
ChoosePixelFormat doesn''t mean OpenGL will give that to you
in all cases. It might give you something totally different.

Check out the pixel format that was returned and see if it
really does support all those features you requested.

Share this post


Link to post
Share on other sites

you are requesting a 16-bit window- is your screen mode 16bpp or other? maybe it''s forcing a change to accomodate your bpp requirement?



Share this post


Link to post
Share on other sites
How would I check the pixel format? I''m trying to learn from NeHe''s tutorials and that''s the pixelformat he used and his examples when I downloaded them worked(Even if I modified them) though I tried to use his way to create a window and it does this.
Ranger_One, I''m using 16bpp (High Color(16 bit)). I use 16 because I heard that that''s the best for a Voodoo 3 and in 24bpp things are slightly different(Yellow shadow on message box information icon).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!