make threaded rendering work correctly, fdo#81110

The context may only be bound in one thread!

Change-Id: Ibb67f88c2f11fd48884ee39d89620193e4e5471b
This commit is contained in:
Markus Mohrhard 2014-07-13 07:52:51 +02:00
parent 47a82452b5
commit dde00f1f8a
3 changed files with 16 additions and 0 deletions

View file

@ -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

View file

@ -151,6 +151,7 @@ public:
bool init(SystemChildWindow* pChildWindow);
void makeCurrent();
void resetCurrent();
void swapBuffers();
void sync();
void show();

View file

@ -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 )