Add error handling for SDL_GL_CreateContext

This commit is contained in:
Daniel Nagel committed 2014-09-02 07:34:08 +02:00
1 parent 66c19727ce
commit 439ea67cc2
1 file changed
+6 -1
+6 -1
View File
@@ -502,12 +502,17 @@ int main(int argc, char *argv[]) {
g_Screen = SDL_CreateWindow(app_name_nice.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, pixel_xres, pixel_yres, mode);
if (g_Screen == NULL) {
fprintf(stderr, "SDL SetVideoMode failed: Unable to create OpenGL screen: %s\n", SDL_GetError());
fprintf(stderr, "SDL_CreateWindow failed: %s\n", SDL_GetError());
SDL_Quit();
return 2;
}
SDL_GLContext glContext = SDL_GL_CreateContext(g_Screen);
if (glContext == NULL) {
fprintf(stderr, "SDL_GL_CreateContext failed: %s\n", SDL_GetError());
SDL_Quit();
return 2;
}
#ifdef USING_EGL
EGL_Init();