ee2dbcada8
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 <laszlo.agocs@qt.io>
26 lines
765 B
C++
26 lines
765 B
C++
// Copyright (C) 2022 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#include "mainwindow.h"
|
|
#include <QApplication>
|
|
#include <QMenuBar>
|
|
#include "glwidget.h"
|
|
|
|
MainWindow::MainWindow()
|
|
{
|
|
GLWidget *glwidget = new GLWidget(qRgb(20, 20, 50));
|
|
setCentralWidget(glwidget);
|
|
|
|
QMenu *screenShotMenu = menuBar()->addMenu("&Screenshot");
|
|
screenShotMenu->addAction("Left buffer", this, [glwidget](){
|
|
glwidget->saveImage(QOpenGLWidget::LeftBuffer);
|
|
});
|
|
|
|
screenShotMenu->addAction("Right buffer", this, [glwidget](){
|
|
glwidget->saveImage(QOpenGLWidget::RightBuffer);
|
|
});
|
|
|
|
QMenu *helpMenu = menuBar()->addMenu("&Help");
|
|
helpMenu->addAction("About Qt", qApp, &QApplication::aboutQt);
|
|
}
|