summaryrefslogtreecommitdiffstats
path: root/tests/manual/rhi/stereo/main.cpp
blob: cae25c8d24d2b4bc227b5b1265f2fe5a03216d00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}