Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
4.6.3
-
None
Description
The documentation of the constructor of QGLPixelBuffer contains the following sentence:
If the shareWidget parameter points to a valid QGLWidget, the pbuffer will share its context with shareWidget.
This is factually wrong. If you look at the code in QGLPixelBufferPrivate::common_init(), you will see that a context is always created:
qctx = new QGLContext(format); qctx->d_func()->sharing = (shareWidget != 0); if (shareWidget != 0 && shareWidget->d_func()->glcx) { QGLContextGroup::addShare(qctx, shareWidget->d_func()->glcx); shareWidget->d_func()->glcx->d_func()->sharing = true; }
What happens here is that the pixel buffer is always associated to a new context, but, by passing a share widget, you can share display lists and texture objects between the pixel buffer and the widget. Sharing the context is a completely different beast compared to having two context with shared objects.
For comparison, look at the documentation of QGLWidget's constructor, where shareWidget has exactly the same meaning but it is correctly documented.
As a closing note, there is currently no way in Qt to construct a pbuffer that really shares the context with an existing one. QGLWidget allows this by let the user pass an existing QGLContext in one of its constructor. Maybe it is a worthwhile addition for the future.