diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 14:59:30 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-11-26 15:06:05 (GMT) |
commit | 71abe300263d9f6bcd6e061e889a58111c48f92a (patch) | |
tree | 1d56f5244b8336de0b64e6e3131b8cedb514be6a /src/opengl/qgl.cpp | |
parent | 896c51e4d41a7fee06a1601f1b25746f9f98be88 (diff) | |
download | Qt-71abe300263d9f6bcd6e061e889a58111c48f92a.zip Qt-71abe300263d9f6bcd6e061e889a58111c48f92a.tar.gz Qt-71abe300263d9f6bcd6e061e889a58111c48f92a.tar.bz2 |
Make QtOpenGL use shared contextexts on Lighthouse
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 111a3e4..dc7a333 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2095,14 +2095,6 @@ QGLContext::QGLContext(const QGLFormat &format) d->init(0, format); } -QGLContext::QGLContext(QPlatformGLContext *platformContext) - : d_ptr(new QGLContextPrivate(this)) -{ - Q_D(QGLContext); - d->init(0,QGLFormat::fromPlatformWindowFormat(platformContext->platformWindowFormat())); - d->platformContext = platformContext; -} - /*! Destroys the OpenGL context and frees its resources. */ @@ -3788,7 +3780,13 @@ QGLWidget::QGLWidget(QWidget *parent, const QGLWidget* shareWidget, Qt::WindowFl setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(true); // for compatibility #ifdef Q_WS_QPA - setPlatformWindowFormat(QGLFormat::toPlatformWindowFormat(QGLFormat::defaultFormat())); + QPlatformWindowFormat platformFormat = QGLFormat::toPlatformWindowFormat(QGLFormat::defaultFormat()); + platformFormat.setUseDefaultSharedContext(false); + if (shareWidget && shareWidget->d_func()->glcx) { + QPlatformGLContext *sharedPlatformContext = shareWidget->d_func()->glcx->d_func()->platformContext; + platformFormat.setSharedContext(sharedPlatformContext); + } + setPlatformWindowFormat(platformFormat); winId(); // create window; QGLContext *glContext = 0; if (platformWindow()) @@ -3839,7 +3837,13 @@ QGLWidget::QGLWidget(const QGLFormat &format, QWidget *parent, const QGLWidget* setAttribute(Qt::WA_NoSystemBackground); setAutoFillBackground(true); // for compatibility #ifdef Q_WS_QPA - setPlatformWindowFormat(QGLFormat::toPlatformWindowFormat(QGLFormat::defaultFormat())); + QPlatformWindowFormat platformFormat = QGLFormat::toPlatformWindowFormat(format); + platformFormat.setUseDefaultSharedContext(false); + if (shareWidget && shareWidget->d_func()->glcx) { + QPlatformGLContext *sharedPlatformContext = shareWidget->d_func()->glcx->d_func()->platformContext; + platformFormat.setSharedContext(sharedPlatformContext); + } + setPlatformWindowFormat(platformFormat); winId(); // create window; QGLContext *glContext = 0; if (platformWindow()) |