summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d30ac171da83..6267a9f0e517 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1137,7 +1137,8 @@ SystemWindowData OpenGLContext::generateWinData(vcl::Window* pParent, bool)
void OpenGLContext::makeCurrent()
{
#if defined( WNT )
- if (wglGetCurrentContext() == m_aGLWin.hRC)
+ if (wglGetCurrentContext() == m_aGLWin.hRC &&
+ wglGetCurrentDC() == m_aGLWin.hDC)
{
SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
}
@@ -1151,11 +1152,13 @@ void OpenGLContext::makeCurrent()
#elif defined( IOS ) || defined( ANDROID )
// nothing
#elif defined( UNX )
- if (glXGetCurrentContext() == m_aGLWin.ctx)
+ GLXDrawable nDrawable = mbPixmap ? m_aGLWin.glPix : m_aGLWin.win;
+ if (glXGetCurrentContext() == m_aGLWin.ctx &&
+ glXGetCurrentDrawable() == nDrawable)
{
SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
}
- else if (!glXMakeCurrent( m_aGLWin.dpy, mbPixmap ? m_aGLWin.glPix : m_aGLWin.win, m_aGLWin.ctx ))
+ else if (!glXMakeCurrent( m_aGLWin.dpy, nDrawable, m_aGLWin.ctx ))
SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed");
#endif
}