Fixed issue where the context couldn't be unbound after the window is shown because the current context was already marked as NULL. (Thanks to John McDonald for tracking that down!)
--- a/src/video/SDL_video.c Thu Sep 06 21:34:52 2012 -0700
+++ b/src/video/SDL_video.c Mon Sep 10 20:25:55 2012 -0700
@@ -107,11 +107,6 @@
return retval; \
}
-#define INVALIDATE_GLCONTEXT() \
- _this->current_glwin = NULL; \
- _this->current_glctx = NULL;
-
-
/* Support for framebuffer emulation using an accelerated renderer */
#define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
@@ -1865,14 +1860,12 @@
void
SDL_OnWindowShown(SDL_Window * window)
{
- INVALIDATE_GLCONTEXT();
SDL_OnWindowRestored(window);
}
void
SDL_OnWindowHidden(SDL_Window * window)
{
- INVALIDATE_GLCONTEXT();
SDL_UpdateFullscreenMode(window, SDL_FALSE);
}
@@ -1897,6 +1890,13 @@
if (FULLSCREEN_VISIBLE(window)) {
SDL_UpdateFullscreenMode(window, SDL_TRUE);
}
+
+ /* This needs to be done on iOS to rebind the nscontext to the view,
+ and (hopefully) doesn't hurt on other systems.
+ */
+ if (window == _this->current_glwin) {
+ _this->GL_MakeCurrent(_this, _this->current_glwin, _this->current_glctx);
+ }
}
void