From 6662f4dc2bd56f3488a350af29ca6ab25e23deed Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 18 Jul 2011 14:30:46 -0700 Subject: [PATCH] Record the new OpenGL context as current during SDL_GL_CreateContext(). --- src/video/SDL_video.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index ab178b924..eaad1ad14 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -2459,13 +2459,21 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) 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