summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-02-18 23:33:38 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-19 00:27:06 +0100
commit54e66cba3b7691ce4acf7fac947241058faf0fc3 (patch)
treecaa70fc9a7ef8ff9d21dc64621ac2a3f346dd1d3 /chart2
parentcdb405f4e4b168d1e2f6dea9ac985df319a76015 (diff)
avoid calling glew repeatedly
This saves us about 10% of the rendering time. Change-Id: I3ea7f1849500b025830b44c5175d79ad04aff362
Diffstat (limited to 'chart2')
-rwxr-xr-xchart2/source/view/main/OpenGLRender.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 83d68bd57414..9b4cd8d6fe85 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -84,6 +84,7 @@ int static checkGLError(const char *file, int line)
return retCode;
}
+static bool bGlewInit = false;
#define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__)
@@ -235,11 +236,16 @@ GLfloat texCoords[] = {
int OpenGLRender::InitOpenGL(GLWindow aWindow)
{
glWin = aWindow;
- glewExperimental = GL_TRUE;
- if (glewInit() != GLEW_OK)
+ if(!bGlewInit)
{
- SAL_WARN("chart2.opengl", "Failed to initialize GLEW");
- return -1;
+ glewExperimental = GL_TRUE;
+ if (glewInit() != GLEW_OK)
+ {
+ SAL_WARN("chart2.opengl", "Failed to initialize GLEW");
+ return -1;
+ }
+ else
+ bGlewInit = true;
}
// These guys don't just check support but setup the vtables.