diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-08-18 15:38:04 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-09-02 01:08:48 +0200 |
commit | 276b3d1f8ab2f67b403e312a94c9abe6ae7b792f (patch) | |
tree | 265ae75c9cf22d5a6881a17e430f52402ffcc3d5 | |
parent | 7741e4c2e51d43b2bbced7cc25e39959cacd9cfe (diff) |
extract some shared code
Change-Id: I062ea860f695189ab1d59615f1d2390710a21d44
-rw-r--r-- | chart2/source/view/main/GL3DRenderer.cxx | 20 | ||||
-rw-r--r-- | chart2/source/view/main/OpenGLRender.cxx | 22 | ||||
-rw-r--r-- | include/vcl/opengl/OpenGLHelper.hxx | 4 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLHelper.cxx | 13 |
4 files changed, 17 insertions, 42 deletions
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index 417ac034d0b2..999b9df12b80 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -34,26 +34,6 @@ namespace { const int CORNER_DIVION_Y = 20; const int CORNER_DIVION_Z = 20; -int static checkGLError(const char *file, int line) -{ - GLenum glErr; - int retCode = 0; - glErr = glGetError(); - while (glErr != GL_NO_ERROR) - { - const char* sError = OpenGLHelper::GLErrorString(glErr); - if (sError) - SAL_WARN("chart2.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << file << " at line: " << line); - else - SAL_WARN("chart2.opengl", "GL Error #" << glErr << " (no message available) in File " << file << " at line: " << line); - retCode = -1; - return retCode; - } - return retCode; -} - -#define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__) - GLfloat texCoords[] = { 1.0f, 0.0f, 1.0f, 1.0f, diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 1075b86cc497..c714a43c37ed 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -66,28 +66,6 @@ static GLfloat coordReverseVertices[] = { 0.0f, 0.0f, }; -int static checkGLError(const char *file, int line) -{ - GLenum glErr; - int retCode = 0; - glErr = glGetError(); - while (glErr != GL_NO_ERROR) - { - const char* sError = OpenGLHelper::GLErrorString(glErr); - - if (sError) - SAL_WARN("chart2.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << file << " at line: " << line); - else - SAL_WARN("chart2.opengl", "GL Error #" << glErr << " (no message available) in File " << file << " at line: " << line); - - retCode = -1; - return retCode; - } - return retCode; -} - -#define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__) - #define CHECK_GL_FRAME_BUFFER_STATUS() \ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\ if( status != GL_FRAMEBUFFER_COMPLETE ) {\ diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx index 8b18964eb5f6..f4ed8ea288d3 100644 --- a/include/vcl/opengl/OpenGLHelper.hxx +++ b/include/vcl/opengl/OpenGLHelper.hxx @@ -44,8 +44,12 @@ public: // Get OpenGL version (needs a context) static float getGLVersion(); + + static void checkGLError(const char* aFile, size_t nLine); }; +#define CHECK_GL_ERROR() OpenGLHelper::checkGLError(__FILE__, __LINE__) + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 16dd5b7a9411..1bd69c221be2 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -337,5 +337,18 @@ float OpenGLHelper::getGLVersion() return fVersion; } +void OpenGLHelper::checkGLError(const char* pFile, size_t nLine) +{ + GLenum glErr = glGetError(); + while (glErr != GL_NO_ERROR) + { + const char* sError = OpenGLHelper::GLErrorString(glErr); + + if (sError) + SAL_WARN("vcl.opengl", "GL Error #" << glErr << "(" << sError << ") in File " << pFile << " at line: " << nLine); + else + SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available) in File " << pFile << " at line: " << nLine); + } +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |