[Interest] QOpenGLWidget and quad-buffer stereo

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Tue Dec 24 18:46:41 CET 2019


Hi,

On 20/12/2019 14:57, Tilmann Krueger wrote:
> Are we doing something wrong? How is one supposed to set this up 
> correctly? Or are we really stuck with QGLWidget?
> 
> All tried with a Windows 10 1903, with Quadro FX 4600 and a nvidia 3d 
> vision compatible display from Acer.

Not trying to give an "ultimate" answer, but I strongly doubt what 
you're doing is feasable with QOpenGLWidget. A fundamental difference 
between QOpenGLWidget and QGLWidget is that with QOpenGLWidget you don't 
draw to the screen, you draw into a FBO. The contents of this FBO are 
then "composed" with the rest of the contents (raster, other 
QOpenGLWidgets, other QQuickWidgets, etc.) of a given top level window.

... This involves Qt setting up a GL top level window, creating a GL 
context for it to do the composition, creating another context for your 
QOpenGLWidget sharing with the first context, and a lot of extra magic; 
the only way for you to control the creation of these GL contexts is via 
"global" settings (setDefaultFormat()) ...

For this reason I don't think stereo/quad rendering is supported at all 
via QOpenGLWidget. The FBO created by Qt for your QOpenGLWidget will 
only have a single color attachment, and the composition step will just 
use that one to create the final contents of the window (instead of 
using multiple draw buffers).


OTOH, QGLWidget has its own surface, its own OpenGL context, and hence 
its own OpenGL settings) and draws directly to the screen. This allows 
you to have _almost_ full control over its OpenGL rendering, and to 
easily have multiple draw buffers for stereo/quad rendering.

For cases like this one, the direct upgrade path from QGLWidget is NOT 
QOpenGLWidget, but QWindow+QOpenGLContext (or the QOpenGLWindow 
convenience, etc.) + QWidget::createWindowContainer.


HTH,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20191224/593491dd/attachment.bin>


More information about the Interest mailing list