Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Windows: Don't lose the existing current GL context in SDL_CreateWind…
Browse files Browse the repository at this point in the history
…ow().

Fixes Bugzilla #1395.
  • Loading branch information
icculus committed Aug 1, 2013
1 parent 7e90aff commit ea9b11f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/video/windows/SDL_windowswindow.c
Expand Up @@ -231,10 +231,15 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
}
#if SDL_VIDEO_OPENGL_WGL
if (window->flags & SDL_WINDOW_OPENGL) {
/* The current context is lost in SDL_GL_SetupWindow; recover it. */
SDL_Window *current_win = SDL_GL_GetCurrentWindow();
SDL_GLContext current_ctx = SDL_GL_GetCurrentContext();
if (WIN_GL_SetupWindow(_this, window) < 0) {
WIN_DestroyWindow(_this, window);
WIN_GL_MakeCurrent(_this, current_win, current_ctx);
return -1;
}
WIN_GL_MakeCurrent(_this, current_win, current_ctx);
}
#endif
return 0;
Expand Down

0 comments on commit ea9b11f

Please sign in to comment.