summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/controls/main.cpp
blob: b0792961c53c871992e1f04791ff4d1547024796 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QGuiApplication>
#include <QQuickView>
#include <QQmlContext>
#include <Qt3DRender/qt3drender-config.h>

int main(int argc, char **argv)
{
    const bool useUnderLayCompositingMode = false;

    if (useUnderLayCompositingMode) {
        // underLay compositing does not work with RHI renderer
        qputenv("QT3D_RENDERER", "opengl");
        qputenv("QSG_RHI_BACKEND", "opengl");
    }

    QSurfaceFormat format;
    format.setSamples(4);
    QSurfaceFormat::setDefaultFormat(format);

    QGuiApplication app(argc, argv);
    QQuickView view;

    view.resize(520, 500);
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.rootContext()->setContextProperty("_useUnderLayCompositingMode", useUnderLayCompositingMode);
    view.setSource(QUrl("qrc:/main.qml"));
    view.show();

    return app.exec();
}