From d52ea19862461c7f6f49f8233594d83e1c00cde8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 2 Dec 2014 16:59:53 +0100 Subject: Take ShareOpenGLContexts into account in QOpenGLWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While the attribute was originally intended for widgets (QOpenGLWidget, QQuickWidget) only, we need a way to get multiple QOpenGLWindow instances whose contexts share with each other. Change-Id: Ib983c9c2815b0a3911bc504ffad8d8dddad192aa Reviewed-by: Jørgen Lind --- src/gui/kernel/qopenglwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index 158fb248dc..c37974c429 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -101,6 +102,10 @@ QT_BEGIN_NAMESPACE this way they do not have to redraw the entire window content on each paintGL() call. + Similarly to QOpenGLWidget, QOpenGLWindow supports the Qt::AA_ShareOpenGLContexts + attribute. When enabled, the OpenGL contexts of all QOpenGLWindow instances will share + with each other. This allows accessing each other's shareable OpenGL resources. + For more information on graphics in Qt, see \l {Graphics}. */ @@ -196,6 +201,7 @@ public: if (!context) { context.reset(new QOpenGLContext); + context->setShareContext(qt_gl_global_share_context()); context->setFormat(q->requestedFormat()); if (!context->create()) qWarning("QOpenGLWindow::beginPaint: Failed to create context"); -- cgit v1.2.3