Jump to content
  • Advertisement
Sign in to follow this  
deepsender

SDL/Opengl window re-sizing

This topic is 4151 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

I'm using Opengl and SDL under Windows. OpenGL for 3D. SDL for the window, some 2D, and text fonts. Problems happen when I re-size the window. OpenGL works, but SDL acts as if the window was not changed. If I call SDL_SetVideoMode() after re-sizing, OpenGL 3D does not work properly, goes very dim, shows only gl_lines. Any ideas to make this work? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
The consensus (also among the SDL developers) seems to be that this does not work reliably (not on all platforms anyway). Having seen many related bugs I certainly agree with them. What you should do is completely initializing your renderer again, treat it like a fresh program start. That's also what you see in some id games (eg. Quake3).

If you absolutely can't live with this eg. you're doing a windowed 3D modelling app not a game then perhaps look at the Irrlicht or Ogre codebases and see if they can do it with native Windows code.

Share this post


Link to post
Share on other sites
I haven't yet figured this out, but i notice that many game do indeed treat resizing the screen as a separate program start, and tend to re-initialize things for several seconds before you can play again. Currently, my game engine only sizes the screen on startup. If I remember correctly, thats how its done in the engine for Doom 3.

Share this post


Link to post
Share on other sites
After you get the SDL_VIDEORESIZE event from SDL, are you calling SDL_SetVideoMode again with the new size and passing the SDL_OPENGL flag, and then calling glViewport to recognize the new size before doing whatever you have to do to set the projections up?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!