| 1 | // Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include <QGuiApplication> |
| 5 | #include <QQuickView> |
| 6 | #include <QOpenGLContext> |
| 7 | |
| 8 | int main(int argc, char **argv) |
| 9 | { |
| 10 | qputenv("QSG_RHI_BACKEND", "opengl"); |
| 11 | qputenv("QT3D_RENDERER", "opengl"); |
| 12 | |
| 13 | QGuiApplication app(argc, argv); |
| 14 | |
| 15 | QSurfaceFormat format; |
| 16 | if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { |
| 17 | format.setVersion(3, 2); |
| 18 | format.setProfile(QSurfaceFormat::CoreProfile); |
| 19 | format.setDepthBufferSize(24); |
| 20 | format.setStencilBufferSize(8); |
| 21 | } |
| 22 | |
| 23 | QQuickView view; |
| 24 | view.setFormat(format); |
| 25 | view.resize(1200, 600); |
| 26 | view.setResizeMode(QQuickView::SizeRootObjectToView); |
| 27 | view.setSource(QUrl("qrc:/main.qml")); |
| 28 | view.show(); |
| 29 | |
| 30 | return app.exec(); |
| 31 | } |