|
15 | 15 | #include <boost/nowide/iostream.hpp> |
16 | 16 | #include <SDL.h> |
17 | 17 | #include <SDL_hints.h> |
| 18 | +#include <SDL_video.h> |
18 | 19 | #include <algorithm> |
19 | 20 | #include <memory> |
20 | 21 |
|
@@ -47,14 +48,6 @@ struct SDLMemoryDeleter |
47 | 48 | void operator()(T* p) const { SDL_free(p); } |
48 | 49 | }; |
49 | 50 |
|
50 | | -#if RTTR_OGL_ES || RTTR_OGL_GL4ES |
51 | | -constexpr SDL_GLprofile RTTR_SDL_GL_PROFILE = SDL_GL_CONTEXT_PROFILE_ES; |
52 | | -#elif RTTR_OGL_COMPAT |
53 | | -constexpr SDL_GLprofile RTTR_SDL_GL_PROFILE = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY; |
54 | | -#else |
55 | | -constexpr SDL_GLprofile RTTR_SDL_GL_PROFILE = SDL_GL_CONTEXT_PROFILE_CORE; |
56 | | -#endif |
57 | | - |
58 | 51 | template<typename T> |
59 | 52 | using SDL_memory = std::unique_ptr<T, SDLMemoryDeleter<T>>; |
60 | 53 |
|
@@ -147,7 +140,15 @@ bool VideoSDL2::CreateScreen(const std::string& title, const VideoMode& size, bo |
147 | 140 | // GL-Attributes |
148 | 141 | CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RTTR_OGL_MAJOR)); |
149 | 142 | CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RTTR_OGL_MINOR)); |
150 | | - CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, RTTR_SDL_GL_PROFILE)); |
| 143 | + SDL_GLprofile profile; |
| 144 | + if(RTTR_OGL_ES || RTTR_OGL_GL4ES) |
| 145 | + profile = SDL_GL_CONTEXT_PROFILE_ES; |
| 146 | + else if(RTTR_OGL_COMPAT) |
| 147 | + profile = SDL_GL_CONTEXT_PROFILE_COMPATIBILITY; |
| 148 | + else |
| 149 | + profile = SDL_GL_CONTEXT_PROFILE_CORE; |
| 150 | + |
| 151 | + CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile)); |
151 | 152 |
|
152 | 153 | CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8)); |
153 | 154 | CHECK_SDL(SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8)); |
|
0 commit comments