diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-09-09 10:06:45 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-09-10 13:36:27 +0200 |
commit | 2f96fb1beec5251e27381c09d0ad810c6e829c37 (patch) | |
tree | 4e7cd85d7e1175657a0d91c1e0076ef156b71c68 /src/widgets/kernel | |
parent | 162010441f876788428aaacf9a00312d3175d150 (diff) |
Add an option to share between TLWs
Task-number: QTBUG-41191
Change-Id: I510d1631926ed0d9e371703d22229aed92432aa6
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 3dae22cdc7..8f7751618d 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -297,6 +297,18 @@ QT_BEGIN_NAMESPACE sharable resources, like textures, and there is no need for an extra "global share" context, as was the case with QGLWidget. + To set up sharing between QOpenGLWidget instances belonging to different + windows, set the Qt::AA_ShareOpenGLContexts application attribute before + instantiating QApplication. This will trigger sharing between all + QOpenGLWidget instances without any further steps. + + Creating extra QOpenGLContext instances that share resources like textures + with the QOpenGLWidget's context is also possible. Simply pass the pointer + returned from context() to QOpenGLContext::setShareContext() before calling + QOpenGLContext::create(). The resulting context can also be used on a + different thread, allowing threaded generation of textures and asynchronous + texture uploads. + Note that QOpenGLWidget expects a standard conformant implementation of resource sharing when it comes to the underlying graphics drivers. For example, some drivers, in particular for mobile and embedded hardware, have @@ -359,11 +371,12 @@ QT_BEGIN_NAMESPACE each QOpenGLWidget's associated context is destroyed together with the QOpenGLWidget, the sharable resources in that context, like textures, will stay valid until the top-level window, in which the QOpenGLWidget lived, is - destroyed. Additionally, some Qt modules may trigger an even wider scope for - sharing contexts, potentially leading to keeping the resources in question - alive for the entire lifetime of the application. Therefore the safest and - most robust is always to perform explicit cleanup for all resources and - resource wrappers used in the QOpenGLWidget. + destroyed. Additionally, settings like Qt::AA_ShareOpenGLContexts and some Qt + modules may trigger an even wider scope for sharing contexts, potentially + leading to keeping the resources in question alive for the entire lifetime of + the application. Therefore the safest and most robust is always to perform + explicit cleanup for all resources and resource wrappers used in the + QOpenGLWidget. \section1 Limitations @@ -388,7 +401,7 @@ QT_BEGIN_NAMESPACE \e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.} - \sa QOpenGLFunctions, QOpenGLWindow + \sa QOpenGLFunctions, QOpenGLWindow, Qt::AA_ShareOpenGLContexts */ /*! |