summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/graphicsmanager.cpp33
-rw-r--r--src/graphicsmanager.h2
-rw-r--r--src/resources/openglimagehelper.cpp28
3 files changed, 38 insertions, 25 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index ba96041be..b230d77cf 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -728,6 +728,39 @@ unsigned int GraphicsManager::getLastError()
return error;
}
+std::string GraphicsManager::errorToString(GLenum error)
+{
+ if (error)
+ {
+ std::string errmsg = "Unknown error";
+ switch (error)
+ {
+ case GL_INVALID_ENUM:
+ errmsg = "GL_INVALID_ENUM";
+ break;
+ case GL_INVALID_VALUE:
+ errmsg = "GL_INVALID_VALUE";
+ break;
+ case GL_INVALID_OPERATION:
+ errmsg = "GL_INVALID_OPERATION";
+ break;
+ case GL_STACK_OVERFLOW:
+ errmsg = "GL_STACK_OVERFLOW";
+ break;
+ case GL_STACK_UNDERFLOW:
+ errmsg = "GL_STACK_UNDERFLOW";
+ break;
+ case GL_OUT_OF_MEMORY:
+ errmsg = "GL_OUT_OF_MEMORY";
+ break;
+ default:
+ break;
+ }
+ return errmsg;
+ }
+ return "";
+}
+
void GraphicsManager::detectVideoSettings()
{
config.setValue("videodetected", true);
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 9523fb3d0..ccc988523 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -112,6 +112,8 @@ class GraphicsManager final
unsigned int getLastError();
+ static std::string errorToString(GLenum error);
+
void updateDebugLog();
#endif
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index b250ad29d..3b93460ad 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -266,31 +266,9 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage)
GLenum error = glGetError();
if (error)
{
- std::string errmsg = "Unknown error";
- switch (error)
- {
- case GL_INVALID_ENUM:
- errmsg = "GL_INVALID_ENUM";
- break;
- case GL_INVALID_VALUE:
- errmsg = "GL_INVALID_VALUE";
- break;
- case GL_INVALID_OPERATION:
- errmsg = "GL_INVALID_OPERATION";
- break;
- case GL_STACK_OVERFLOW:
- errmsg = "GL_STACK_OVERFLOW";
- break;
- case GL_STACK_UNDERFLOW:
- errmsg = "GL_STACK_UNDERFLOW";
- break;
- case GL_OUT_OF_MEMORY:
- errmsg = "GL_OUT_OF_MEMORY";
- break;
- default:
- break;
- }
- logger->log("Error: Image GL import failed: %s", errmsg.c_str());
+ std::string errmsg = GraphicsManager::errorToString(error);
+ logger->log("Error: Image GL import failed: %s (%d)",
+ errmsg.c_str(), error);
return nullptr;
}