diff options
Diffstat (limited to 'tests/manual/rhi/stereo/main.cpp')
-rw-r--r-- | tests/manual/rhi/stereo/main.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/manual/rhi/stereo/main.cpp b/tests/manual/rhi/stereo/main.cpp new file mode 100644 index 0000000000..cae25c8d24 --- /dev/null +++ b/tests/manual/rhi/stereo/main.cpp @@ -0,0 +1,36 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only + +// This is a demo showing stereoscopic rendering. +// For now, the backend is hardcoded to be OpenGL, because that's the only +// supported backend. + +#include <QGuiApplication> +#include <QCommandLineParser> +#include "window.h" + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + QSurfaceFormat fmt; + fmt.setDepthBufferSize(24); + fmt.setStencilBufferSize(8); + + // Request stereoscopic rendering support with left/right buffers + fmt.setStereo(true); + + QSurfaceFormat::setDefaultFormat(fmt); + + Window w{QRhi::Vulkan}; + w.resize(1280, 720); + w.setTitle(QCoreApplication::applicationName()); + w.show(); + + int ret = app.exec(); + + if (w.handle()) + w.releaseSwapChain(); + + return ret; +} |