summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-03 02:01:34 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-03 02:01:34 +0300
commitf43602b237228935ca468dc3388db0ab761ddbbb (patch)
tree6272c2645cf0e2a957f5ca02f48c55f97c223ef5 /src
parent804e478a1bae58f779a9e6c0e6abafeedd172497 (diff)
downloadManaVerse-f43602b237228935ca468dc3388db0ab761ddbbb.tar.gz
ManaVerse-f43602b237228935ca468dc3388db0ab761ddbbb.tar.bz2
ManaVerse-f43602b237228935ca468dc3388db0ab761ddbbb.tar.xz
ManaVerse-f43602b237228935ca468dc3388db0ab761ddbbb.zip
Show error messages in SDL2 OpenGL context creation function.
Diffstat (limited to 'src')
-rw-r--r--src/utils/sdl2helper.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp
index e9db1fb61..f0a3b7616 100644
--- a/src/utils/sdl2helper.cpp
+++ b/src/utils/sdl2helper.cpp
@@ -104,6 +104,13 @@ void *SDL::createGLContext(SDL_Window *const window,
// SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
SDL_ClearError();
void *context = SDL_GL_CreateContext(window);
+ if (SDL_GetError())
+ {
+ logger->log("Error to switch to context %d.%d: %s",
+ major,
+ minor,
+ SDL_GetError());
+ }
if (SDL_GetError() && (major > 3 || (major == 3 && minor > 3)))
{
logger->log("Try fallback to OpenGL 3.3 core context");
@@ -111,6 +118,11 @@ void *SDL::createGLContext(SDL_Window *const window,
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_ClearError();
context = SDL_GL_CreateContext(window);
+ if (SDL_GetError())
+ {
+ logger->log("Error to switch to core context 3.3: %s",
+ SDL_GetError());
+ }
if (SDL_GetError() && profile == 0x01)
{
logger->log("Try fallback to OpenGL 3.3 compatibility context");
@@ -119,15 +131,29 @@ void *SDL::createGLContext(SDL_Window *const window,
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0x02);
SDL_ClearError();
context = SDL_GL_CreateContext(window);
+ if (SDL_GetError())
+ {
+ logger->log("Error to switch to compatibility context 3.3: %s",
+ SDL_GetError());
+ }
}
}
if (SDL_GetError() && (major > 3 || (major == 3 && minor > 0)))
{
+ logger->log("Error to switch to core context %d.%d: %s",
+ major,
+ minor,
+ SDL_GetError());
logger->log("Try fallback to OpenGL 3.0 core context");
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile);
context = SDL_GL_CreateContext(window);
+ if (SDL_GetError())
+ {
+ logger->log("Error to switch to core context 3.0: %s",
+ SDL_GetError());
+ }
}
if (SDL_GetError() && (major > 2 || (major == 2 && minor > 1)))
{
@@ -136,6 +162,11 @@ void *SDL::createGLContext(SDL_Window *const window,
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0x02);
context = SDL_GL_CreateContext(window);
+ if (SDL_GetError())
+ {
+ logger->log("Error to switch to compatibility context 2.1: %s",
+ SDL_GetError());
+ }
}
return context;
}