Debian Codegraph @

tests/manual/rhi/stereo/main.cpp

raw
1 // Copyright (C) 2022 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 // This is a demo showing stereoscopic rendering.
5 // For now, the backend is hardcoded to be OpenGL, because that's the only
6 // supported backend.
7
8 #include <QGuiApplication>
9 #include <QCommandLineParser>
10 #include "window.h"
11
12 int main(int argc, char **argv)
13 {
14 QGuiApplication app(argc, argv);
15
16 QSurfaceFormat fmt;
17 fmt.setDepthBufferSize(24);
18 fmt.setStencilBufferSize(8);
19
20 // Request stereoscopic rendering support with left/right buffers
21 fmt.setStereo(true);
22
23 QSurfaceFormat::setDefaultFormat(fmt);
24
25 Window w{QRhi::Vulkan};
26 w.resize(1280, 720);
27 w.setTitle(QCoreApplication::applicationName());
28 w.show();
29
30 int ret = app.exec();
31
32 if (w.handle())
33 w.releaseSwapChain();
34
35 return ret;
36 }