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!)
authorSam Lantinga <slouken@libsdl.org>
Mon, 10 Sep 2012 20:25:55 -0700
changeset 64189c12f2c8057b
parent 6417 e54cc2d4e89a
child 6419 b75e82af5ef1
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
     1.1 --- a/src/video/SDL_video.c	Thu Sep 06 21:34:52 2012 -0700
     1.2 +++ b/src/video/SDL_video.c	Mon Sep 10 20:25:55 2012 -0700
     1.3 @@ -107,11 +107,6 @@
     1.4          return retval; \
     1.5      }
     1.6  
     1.7 -#define INVALIDATE_GLCONTEXT() \
     1.8 -    _this->current_glwin = NULL; \
     1.9 -    _this->current_glctx = NULL;
    1.10 -
    1.11 -
    1.12  /* Support for framebuffer emulation using an accelerated renderer */
    1.13  
    1.14  #define SDL_WINDOWTEXTUREDATA   "_SDL_WindowTextureData"
    1.15 @@ -1865,14 +1860,12 @@
    1.16  void
    1.17  SDL_OnWindowShown(SDL_Window * window)
    1.18  {
    1.19 -    INVALIDATE_GLCONTEXT();
    1.20      SDL_OnWindowRestored(window);
    1.21  }
    1.22  
    1.23  void
    1.24  SDL_OnWindowHidden(SDL_Window * window)
    1.25  {
    1.26 -    INVALIDATE_GLCONTEXT();
    1.27      SDL_UpdateFullscreenMode(window, SDL_FALSE);
    1.28  }
    1.29  
    1.30 @@ -1897,6 +1890,13 @@
    1.31      if (FULLSCREEN_VISIBLE(window)) {
    1.32          SDL_UpdateFullscreenMode(window, SDL_TRUE);
    1.33      }
    1.34 +
    1.35 +    /* This needs to be done on iOS to rebind the nscontext to the view,
    1.36 +       and (hopefully) doesn't hurt on other systems.
    1.37 +    */
    1.38 +    if (window == _this->current_glwin) {
    1.39 +        _this->GL_MakeCurrent(_this, _this->current_glwin, _this->current_glctx);
    1.40 +    }
    1.41  }
    1.42  
    1.43  void