Jump to content
  • Advertisement
Sign in to follow this  
Phantom5800

OpenGL Losing Texture/VBO/etc when changing resolution in fullscreen

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

So, I "think" I know exactly what is happening. When you change resolution in fullscreen, or go from windowed to fullscreen (or vice-versa), SDL recreates it's OpenGL context, which means all textures, vbos, etc, need to be reloaded into graphics memory (please correct me if this is not entirely true).

What I am attempting to do in order to handle this case:


// WindowSystem_SDL::RefreshWindow
// ...

// unload any resources that depend on opengl context
g_resources->LostDevice();

ConfigureSDLFlags(); // sets flags for opengl context + fullscreen/not-fullscreen
SetAttributes(); // double buffering, hardware accelerated context, etc

// re-create the window
m_screen = SDL_SetVideoMode(m_width, m_height, 32, m_windowFlags);

// reloads all graphics resources
g_resources->FoundDevice();

// ...


Is there any flaw to what I am doing? Something obvious I am missing? Any help would be appreciated.

Share this post


Link to post
Share on other sites
Advertisement
Do a search on these forums. I distinctly remember this very issue being brought up in the past. If I remember correctly, it is a very well known bug in SDL. I don't think there is a solution or work around. You have to reload everything on each resolution change.

Share this post


Link to post
Share on other sites
I've tried searching previous posts and haven't been able to find anything (at least not that I don't already know). I am destroying everything and recreating it after changing the resolution as you can see from my code snippet, I just don't understand what I'm doing wrong so that nothing draws after toggling fullscreen or changing resolution while in fullscreen (I can change the window size in windowed mode just fine). I can post any of my code, I'm just not sure what exactly would be relevant to anyone that might know how to fix this.

When I recreate everything, I just do the exact same process of creating all my resources as I did when originally loading them.

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.

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!