summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorLouis-Francis Ratté-Boulianne <lfrb@collabora.com>2014-11-04 17:32:48 -0500
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-11-10 07:59:03 +0100
commitb116b4efcd78fe1ac8fae465c6dc550595d62a67 (patch)
tree920c4355ca03a6c1a0cc20b32bcf1cef917030c9 /vcl/source
parent42dbcedc73c8daf4753ab85796ea4b9494494ce3 (diff)
vcl: Add list of contexts sharing the same display list
Change-Id: Ib1bca0aaaf41140d6b9a17378094b0f20e469ebd
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 5e23427fa608..a340304fe87d 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -25,6 +25,8 @@
using namespace com::sun::star;
+static std::vector< GLXContext > vShareList;
+
GLWindow::~GLWindow()
{
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
@@ -58,6 +60,8 @@ OpenGLContext::~OpenGLContext()
#elif defined( UNX )
if(m_aGLWin.ctx)
{
+ std::remove( vShareList.begin(), vShareList.end(), m_aGLWin.ctx );
+
glXMakeCurrent(m_aGLWin.dpy, None, NULL);
if( glGetError() != GL_NO_ERROR )
{
@@ -582,13 +586,21 @@ bool OpenGLContext::ImplInit()
#endif
if (!m_aGLWin.ctx)
{
+ GLXContext pSharedCtx( NULL );
+
if (!m_aGLWin.dpy || !m_aGLWin.vi)
return false;
+ if( !vShareList.empty() )
+ pSharedCtx = vShareList.front();
+
m_aGLWin.ctx = m_aGLWin.dpy == 0 ? 0 : glXCreateContext(m_aGLWin.dpy,
m_aGLWin.vi,
- 0,
+ pSharedCtx,
GL_TRUE);
+
+ if( m_aGLWin.ctx )
+ vShareList.push_back( m_aGLWin.ctx );
}
if( m_aGLWin.ctx == NULL )
{