Windows: Don't lose the existing current GL context in SDL_CreateWindow().
Fixes Bugzilla #1395.
This commit is contained in:
parent
51f5bfbc4b
commit
8ed3858721
1 changed files with 5 additions and 0 deletions
|
@ -231,10 +231,15 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
|
||||||
}
|
}
|
||||||
#if SDL_VIDEO_OPENGL_WGL
|
#if SDL_VIDEO_OPENGL_WGL
|
||||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
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) {
|
if (WIN_GL_SetupWindow(_this, window) < 0) {
|
||||||
WIN_DestroyWindow(_this, window);
|
WIN_DestroyWindow(_this, window);
|
||||||
|
WIN_GL_MakeCurrent(_this, current_win, current_ctx);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
WIN_GL_MakeCurrent(_this, current_win, current_ctx);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue