mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-15 14:27:29 +00:00
Improves error messaging and avoids trying to use a null window.
This commit is contained in:
@@ -455,9 +455,13 @@ int main(int argc, char *argv[]) {
|
|||||||
400, 300,
|
400, 300,
|
||||||
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
SDL_GLContext gl_context;
|
||||||
|
if(window) {
|
||||||
|
gl_context = SDL_GL_CreateContext(window);
|
||||||
|
}
|
||||||
if(!window || !gl_context) {
|
if(!window || !gl_context) {
|
||||||
std::cerr << "Could not create window; reported error: \"" << SDL_GetError() << "\"" << std::endl;
|
std::cerr << "Could not create " << (window ? "OpenGL context" : "window");
|
||||||
|
std::cerr << "; reported error: \"" << SDL_GetError() << "\"" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user