Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Courses
Scotty3D
Commits
0258a1ed
Commit
0258a1ed
authored
Oct 16, 2021
by
TheNumbat
Browse files
stop attempting to load gl4.5 on macos
parent
5c0d7c3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/platform/platform.cpp
View file @
0258a1ed
...
...
@@ -73,29 +73,27 @@ void Platform::platform_init() {
die
(
"Failed to create window: %s"
,
SDL_GetError
());
}
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
4
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
5
);
gl_context
=
SDL_GL_CreateContext
(
window
);
if
(
!
gl_context
)
{
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
);
auto
context
=
[
&
](
int
major
,
int
minor
)
{
if
(
gl_context
)
return
;
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
major
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
minor
);
gl_context
=
SDL_GL_CreateContext
(
window
);
if
(
!
gl_context
)
{
warn
(
"Failed to create OpenGL 4.1 context, trying 3.3 (%s)"
,
SDL_GetError
());
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MAJOR_VERSION
,
3
);
SDL_GL_SetAttribute
(
SDL_GL_CONTEXT_MINOR_VERSION
,
3
);
gl_context
=
SDL_GL_CreateContext
(
window
);
if
(
!
gl_context
)
{
die
(
"Failed to create Opengl 3.3 context: %s"
,
SDL_GetError
());
}
}
}
};
#ifndef __APPLE__ // >:|
context
(
4
,
5
);
if
(
!
gl_context
)
info
(
"Failed to create OpenGL 4.5 context, trying 4.1 (%s)"
,
SDL_GetError
());
#endif
context
(
4
,
1
);
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
);
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
())
{
die
(
"Failed to load OpenGL functions."
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment