Record the new OpenGL context as current during SDL_GL_CreateContext().
authorRyan C. Gordon <icculus@icculus.org>
Mon, 18 Jul 2011 14:30:46 -0700
changeset 557070b6f92e4539
parent 5567 441c3036440c
child 5571 a036283f779d
Record the new OpenGL context as current during SDL_GL_CreateContext().
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Fri Jun 10 12:13:06 2011 +0300
     1.2 +++ b/src/video/SDL_video.c	Mon Jul 18 14:30:46 2011 -0700
     1.3 @@ -2459,13 +2459,21 @@
     1.4  SDL_GLContext
     1.5  SDL_GL_CreateContext(SDL_Window * window)
     1.6  {
     1.7 +    SDL_GLContext ctx = NULL;
     1.8      CHECK_WINDOW_MAGIC(window, NULL);
     1.9  
    1.10      if (!(window->flags & SDL_WINDOW_OPENGL)) {
    1.11          SDL_SetError("The specified window isn't an OpenGL window");
    1.12          return NULL;
    1.13      }
    1.14 -    return _this->GL_CreateContext(_this, window);
    1.15 +
    1.16 +    ctx = _this->GL_CreateContext(_this, window);
    1.17 +
    1.18 +    /* Creating a context is assumed to make it current in the SDL driver. */
    1.19 +    _this->current_glwin = window;
    1.20 +    _this->current_glctx = ctx;
    1.21 +
    1.22 +    return ctx;
    1.23  }
    1.24  
    1.25  int