This means your video driver is doing a context reset. The GL_ARB_robustness extension can inform you of this event having occurred, but it’s still up to you to restore all your textures.
Starting in windowed mode may be your better bet, but it likely produces a different swap-chain that runs slower.
When playing a fullscreen game in Windows you get special behavior from the video driver where it does not merely show the desktop and blit the game’s backbuffer to that on each SDL_GL_SwapWindow,
instead it allocates a second framebuffer and alternately renders to one or the other (this skips the blit-to-desktop), or even may allocate three such buffers (triple buffering) if vsync is enabled.
Side effects of double-buffering/triple-buffering of fullscreen games:
- increased framerate (the reason they do this!).
- any popup window will not be visible over the game. (this is why a game that crashes tends to appear to just freeze, but hitting Enter will generally dismiss the game - because the Enter key is
going to the crash dialog, which is hidden by double-buffering/triple-buffering fullscreen games).
- drivers can do elaborate tricks with the buffer swapping (such as stereo flipping for shutter glasses to get a 3D display).
Apparently on at least some configurations, you get a device reset when switching away from such a double-buffered fullscreen window?On 05/31/2014 12:11 PM, Arvind Raja Yadav wrote:
Just switch to windowed and immediately back to fullscreen at the new resolution.
I tried this, and it seems to work. ( Thanks! ) However, I’m encountering a strange situation:
Starting the application in fullscreen mode and then going to windowed mode results in the SDL app losing all its textures, and I need to reload them. However, starting the application in windowed
mode lets me switch back and forth between fullscreen and windowed mode any number of times without any need to reload textures.
Is this expected behavior, and is there any way to avoid this loss of textures?
Arvind Raja Yadav
Pyrodactyl Games http://pyrodactyl.com/
Press Page http://pyrodactyl.com/press
On Sun, Jun 1, 2014 at 12:11 AM, Arvind Raja Yadav <arvindrajayadav at gmail.com <mailto:arvindrajayadav at gmail.com>> wrote:
<The discussion above>
So if I understood the discussion correctly, SDL_SetWindowSize is not a valid function to call when in fullscreen mode (the documentation needs to be updated for this, I believe).
I have to use the "classical" fullscreen mode in my application, which is why I cannot use SDL_FULLSCREEN_DESKTOP sadly.
I could use some help on a valid way to change resolution while in fullscreen mode. Here's the method I tried using SDL_DisplayMode, which didn't work - the resolution stays the same no matter
what values I give to mode.w and mode.h :
//Check the current window flags
Uint32 flags = SDL_GetWindowFlags(gWindow);
//Are we in fullscreen mode right now?
if ((flags & SDL_WINDOW_FULLSCREEN) == SDL_WINDOW_FULLSCREEN)
{
//Use the DisplayMode way of resizing screen
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(0, &mode);
mode.w = gScreenSettings.cur.w;
mode.h = gScreenSettings.cur.h;
SDL_SetWindowDisplayMode(gWindow, &mode);
}
else
{
SDL_SetWindowSize(gWindow, gScreenSettings.cur.w, gScreenSettings.cur.h);
SDL_SetWindowPosition(gWindow, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
}
Did I just use SDL_SetWindowDisplayMode incorrectly, or is something else wrong?
Arvind Raja Yadav
Pyrodactyl Games <http://pyrodactyl.com/>
Press Page <http://pyrodactyl.com/press>
On Sat, May 31, 2014 at 4:39 PM, Arvind Raja Yadav <arvindrajayadav at gmail.com <mailto:arvindrajayadav at gmail.com>> wrote:
Yes, SDL Doesn't allow resolution change once it goes fullscreen.
You could just use the Desktop Resolution instead. Then you can use? SDL_RenderSetLogicalSize() to maintain the aspect ratio.
If you really want to change resolution then you could go: Fullscreen -> Windowed -> (delay) -> Size Change -> (Delay) -> Fullscreen.
I cannot use the logical size portion of the SDL Renderer, as I handle the size/aspect ration stuff in code myself.
To me, this is definitely a bug in SDL2 - nothing in the documentation suggests you can't change resolution while in fullscreen mode. Changing resolution while in fullscreen is a fairly common
scenario as well - lots of other games allow you to do the same thing.
Arvind Raja Yadav
Pyrodactyl Games <http://pyrodactyl.com/>
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
–
LordHavoc
Author of DarkPlaces Quake1 engine - LadyHavoc's DarkPlaces Quake Modification
Co-designer of Nexuiz - Nexuiz Classic – Alientrap
“War does not prove who is right, it proves who is left.” - Unknown
“Any sufficiently advanced technology is indistinguishable from a rigged demo.” - James Klass
“A game is a series of interesting choices.” - Sid Meier