summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-04-28 09:57:29 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-04-28 17:26:34 +0200
commit039c9efa6d007f5512895c0be742e7926c4ac7b2 (patch)
treee2fba744738a61e31a32dea8b3533e0d6b7e2146
parentd87b312bcc8a5e64d9a5d0ea647a1050629421bd (diff)
Introduce OpenGLContext::MakeCurrent for switching between contexts
Change-Id: I00b06d1330241c4df3b07dc6e0019c49fd7aa521
-rw-r--r--avmedia/source/opengl/oglwindow.cxx1
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx1
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx11
3 files changed, 13 insertions, 0 deletions
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index 6d4788a7e675..4eaf8eefe97d 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -101,6 +101,7 @@ void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidt
m_pHandle->viewport.y = nY;
m_pHandle->viewport.width = nWidth;
m_pHandle->viewport.height = nHeight;
+ m_pContext->makeCurrent();
gltf_renderer_set_content(m_pHandle);
gltf_renderer(m_pHandle);
m_pContext->swapBuffers();
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 9d22ae6691ef..9efe3d8e5096 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -149,6 +149,7 @@ public:
bool init(Window* pParent = 0);
bool init(SystemChildWindow* pChildWindow);
+ void makeCurrent();
void swapBuffers();
void setWinSize(const Size& rSize);
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 07b38d2d60bd..5d1d4a0da7fd 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -726,6 +726,17 @@ SystemWindowData OpenGLContext::generateWinData(Window* pParent)
#endif
+void OpenGLContext::makeCurrent()
+{
+#if defined( WNT )
+ wglMakeCurrent(m_aGLWin.hDC,m_aGLWin.hRC);
+#elif defined( MACOSX ) || defined( IOS ) || defined( ANDROID )
+ // nothing
+#elif defined( UNX )
+ glXMakeCurrent( m_aGLWin.dpy, m_aGLWin.win, m_aGLWin.ctx );
+#endif
+}
+
void OpenGLContext::swapBuffers()
{
#if defined( WNT )