summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-13 07:52:51 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-13 07:54:09 +0200
commitdde00f1f8ac598314b7f8a787eeacc841bc65f1c (patch)
treec8d6bb18995fd63fd4f30dc03133ede42ee8ac87
parent47a82452b5040cd712ffafb7d153fd18940ee1af (diff)
make threaded rendering work correctly, fdo#81110
The context may only be bound in one thread! Change-Id: Ibb67f88c2f11fd48884ee39d89620193e4e5471b
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx4
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx1
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx11
3 files changed, 16 insertions, 0 deletions
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 8ce235fb9dae..540615b44f7c 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -407,6 +407,7 @@ void GL3DBarChart::update()
Size aSize = mrWindow.GetSizePixel();
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderOneFrameThread(this));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
}
@@ -441,6 +442,7 @@ void GL3DBarChart::moveToDefault()
Size aSize = mrWindow.GetSizePixel();
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maDefaultCameraPosition, STEPS));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -498,6 +500,7 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
Size aSize = mrWindow.GetSizePixel();
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maTargetPosition, STEPS));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -579,6 +582,7 @@ void GL3DBarChart::moveToCorner()
mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, getCornerPosition(mnCornerId),
maCameraPosition, STEPS));
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
// TODO: moggi: add to thread
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 1e6f13ed3bae..94c70f30c2e1 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -151,6 +151,7 @@ public:
bool init(SystemChildWindow* pChildWindow);
void makeCurrent();
+ void resetCurrent();
void swapBuffers();
void sync();
void show();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 48eb267aa404..dedd5b4953ae 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -800,6 +800,17 @@ void OpenGLContext::makeCurrent()
#endif
}
+void OpenGLContext::resetCurrent()
+{
+#if defined( WNT )
+ wglMakeCurrent( m_aGLWin.hDC, 0 );
+#elif defined( MACOSX ) || defined( IOS ) || defined( ANDROID )
+ // nothing
+#elif defined( UNX )
+ glXMakeCurrent(m_aGLWin.dpy, None, NULL);
+#endif
+}
+
void OpenGLContext::swapBuffers()
{
#if defined( WNT )