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 5570 70b6f92e4539
parent 5567 441c3036440c
child 5571 a036283f779d
Record the new OpenGL context as current during SDL_GL_CreateContext().
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Fri Jun 10 12:13:06 2011 +0300
+++ b/src/video/SDL_video.c	Mon Jul 18 14:30:46 2011 -0700
@@ -2459,13 +2459,21 @@
 SDL_GLContext
 SDL_GL_CreateContext(SDL_Window * window)
 {
+    SDL_GLContext ctx = NULL;
     CHECK_WINDOW_MAGIC(window, NULL);
 
     if (!(window->flags & SDL_WINDOW_OPENGL)) {
         SDL_SetError("The specified window isn't an OpenGL window");
         return NULL;
     }
-    return _this->GL_CreateContext(_this, window);
+
+    ctx = _this->GL_CreateContext(_this, window);
+
+    /* Creating a context is assumed to make it current in the SDL driver. */
+    _this->current_glwin = window;
+    _this->current_glctx = ctx;
+
+    return ctx;
 }
 
 int