From f2ce8f08a26c1226eb6cd8abaac01f95ac185408 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 10 Sep 2012 20:25:55 -0700 Subject: [PATCH] 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!) --- src/video/SDL_video.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 057a5a010..2c3486694 100755 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -107,11 +107,6 @@ static SDL_VideoDevice *_this = NULL; 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 @@ SDL_GetWindowGrab(SDL_Window * window) 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 @@ SDL_OnWindowRestored(SDL_Window * window) 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