From ee2dbcada81f5220a05414d7bf9d5eeebdda8972 Mon Sep 17 00:00:00 2001 From: Kristoffer Skau Date: Thu, 27 Oct 2022 15:38:53 +0200 Subject: Add support for stereoscopic content in QOpenGLWidget Need to add the plumbing necessary to support two textures in QOpenGLWidget and use these in the backing store. The changes required on the RHI level is already done in an earlier patch. Then paintGL() needs to be called twice, once for each buffer. Also add overloads for the other functions of QOopenGLWidget where it makes sense to query for left or right buffer. Then finally create an example. [ChangeLog][Widgets][QOpenGLWidget] Added support for stereoscopic rendering. Fixes: QTBUG-64587 Change-Id: I5a5c53506dcf8a56442097290dceb7eb730d50ce Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidget_p.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/widgets/kernel/qwidget_p.h') diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 65e368d945..ea03e9c708 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -579,7 +579,13 @@ public: virtual QPlatformBackingStoreRhiConfig rhiConfig() const { return {}; } - virtual QRhiTexture *texture() const { return nullptr; } + // Note that textureRight may be null, as it's only used in stereoscopic rendering + struct TextureData { + QRhiTexture *textureLeft = nullptr; + QRhiTexture *textureRight = nullptr; + }; + + virtual TextureData texture() const { return {}; } virtual QPlatformTextureList::Flags textureListFlags() { Q_Q(QWidget); return q->testAttribute(Qt::WA_AlwaysStackOnTop) -- cgit v1.2.3