SDL2: Recovering from alt-tabbing in full-screen mode - HOW?
"Ande" <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
Since my previous question about OpenGL and SDL 1.2 (https://forums.libsdl.org/viewtopic.php?t=12014) got no replies, I bit the bullet and implemented SDL2 support for my game. However, results were not quite what I expected. First of all, some players still report the OpenGL bug is still there - sometimes when they go back to game they get GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 after every GL operation. What should be done about this? Is there any way to recover from this or is SDL2 not usable for all Windows platforms with OpenGL? To make things worse, there are now new problems with the SDL mode, too. I learned the hard way that textures that are used as render targets are lost when alt-tabbing away and back. And this time, there doesn't seem to be any way of noticing the situation. With SDL 1.2, when blit returned -2 I could reload all textures but now there doesn't seem to be any solid way of knowing when things have gone wrong. SDL_SetRenderTarget fails when the game is in background but when it is brought back in, all RenderCopys and SetRenderTargets return success even though they don't work. There even isn't the old way of knowing if the app is active (SDL_GetAppState() & SDL_APPACTIVE) so it is very confusing for me to understand how this should really be handled. If I just listen to window focus event it do esn't guarantee render targets work already. I made a horrible hack where I have a dummy texture I keep putting as render target in every frame and when it starts failing, I delete it and in every frame after that try to recreate it, assuming that when it succeeds and can be put as a target again it is time to recreate all other render targets, too. But this surely cannot be the right way to do it right? _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org