sdl2: I_Error if we can't create gl context

This commit is contained in:
Ronald Kinard 2014-07-23 23:15:31 -05:00
parent fc075e4c81
commit 73e99fa96c
1 changed files with 11 additions and 2 deletions

View File

@ -83,7 +83,7 @@
#endif
// maximum number of windowed modes (see windowedModes[][])
#define MAXWINMODES (16)
#define MAXWINMODES (17)
/** \brief
*/
@ -147,6 +147,7 @@ static INT32 windowedModes[MAXWINMODES][2] =
{1920,1080}, // 1.66
{1680,1050}, // 1.60,5.25
{1600, 900}, // 1.66
{1366, 768}, // 1.66
{1440, 900}, // 1.60,4.50
{1280,1024}, // 1.33?
{1280, 960}, // 1.33,4.00
@ -1684,7 +1685,15 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
if (window != NULL)
{
sdlglcontext = SDL_GL_CreateContext(window);
SDL_GL_MakeCurrent(window, sdlglcontext);
if (sdlglcontext == NULL)
{
SDL_DestroyWindow(window);
I_Error("Failed to create a GL context: %s\n", SDL_GetError());
}
else
{
SDL_GL_MakeCurrent(window, sdlglcontext);
}
}
else return SDL_FALSE;
}