VID_SetMode: for SDL2, move GL context creation to be after the window is shown.

This matches the order used in the SDL2 sample applications included with the library.

Seems to fix an issue on Windows 10 with DPI scaling 150%, launching QS 0.90.1 with  "-width 1920 -height 1080 -fullscreen", and you get a horrible black flicker every few frames.
see http://celephais.net/board/view_thread.php?id=60452&start=1587

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1249 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
ewasylishen 2015-09-07 20:36:43 +00:00
parent a4f3ef53d9
commit 0de318293e

View file

@ -588,10 +588,6 @@ static qboolean VID_SetMode (int width, int height, int bpp, qboolean fullscreen
}
if (!draw_context)
Sys_Error ("Couldn't create window");
gl_context = SDL_GL_CreateContext (draw_context);
if (!gl_context)
Sys_Error ("Couldn't create GL context");
}
/* Ensure the window is not fullscreen */
@ -618,6 +614,13 @@ static qboolean VID_SetMode (int width, int height, int bpp, qboolean fullscreen
SDL_ShowWindow (draw_context);
/* Create GL context if needed */
if (!gl_context) {
gl_context = SDL_GL_CreateContext(draw_context);
if (!gl_context)
Sys_Error("Couldn't create GL context");
}
gl_swap_control = true;
if (SDL_GL_SetSwapInterval ((vid_vsync.value) ? 1 : 0) == -1)
gl_swap_control = false;