Commit 0258a1ed authored by TheNumbat's avatar TheNumbat
Browse files

stop attempting to load gl4.5 on macos

parent 5c0d7c3a
...@@ -73,29 +73,27 @@ void Platform::platform_init() { ...@@ -73,29 +73,27 @@ void Platform::platform_init() {
die("Failed to create window: %s", SDL_GetError()); die("Failed to create window: %s", SDL_GetError());
} }
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); auto context = [&](int major, int minor) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5); if(gl_context) return;
gl_context = SDL_GL_CreateContext(window); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major);
if(!gl_context) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor);
info("Failed to create OpenGL 4.5 context, trying 4.1 (%s)", SDL_GetError());
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
gl_context = SDL_GL_CreateContext(window); gl_context = SDL_GL_CreateContext(window);
if(!gl_context) { };
warn("Failed to create OpenGL 4.1 context, trying 3.3 (%s)", SDL_GetError());
#ifndef __APPLE__ // >:|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); context(4,5);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); if(!gl_context) info("Failed to create OpenGL 4.5 context, trying 4.1 (%s)", SDL_GetError());
gl_context = SDL_GL_CreateContext(window); #endif
if(!gl_context) { context(4,1);
die("Failed to create Opengl 3.3 context: %s", SDL_GetError()); if(!gl_context) warn("Failed to create OpenGL 4.1 context, trying 3.3 (%s)", SDL_GetError());
} context(3,3);
} if(!gl_context) die("Failed to create OpenGL 3.3 context, shutting down (%s)", SDL_GetError());
}
SDL_GL_MakeCurrent(window, gl_context); SDL_GL_MakeCurrent(window, gl_context);
if(SDL_GL_SetSwapInterval(-1)) SDL_GL_SetSwapInterval(1); if(SDL_GL_SetSwapInterval(-1)) {
info("Could not enable vsync with late swap; using normal vsync.");
SDL_GL_SetSwapInterval(1);
}
if(!gladLoadGL()) { if(!gladLoadGL()) {
die("Failed to load OpenGL functions."); die("Failed to load OpenGL functions.");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment