| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | |
| 4 | #include <QGuiApplication> |
| 5 | #include <QQuickView> |
| 6 | #include <QQmlContext> |
| 7 | #include <QOpenGLContext> |
| 8 | #include <Qt3DRender/qt3drender-config.h> |
| 9 | |
| 10 | #include "networkcontroller.h" |
| 11 | |
| 12 | int main(int argc, char **argv) |
| 13 | { |
| 14 | QGuiApplication app(argc, argv); |
| 15 | |
| 16 | QSurfaceFormat format; |
| 17 | if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { |
| 18 | format.setVersion(4, 5); |
| 19 | format.setProfile(QSurfaceFormat::CoreProfile); |
| 20 | } |
| 21 | format.setDepthBufferSize(24); |
| 22 | format.setStencilBufferSize(8); |
| 23 | format.setSamples(4); |
| 24 | #if !QT_CONFIG(qt3d_rhi_renderer) |
| 25 | qputenv("QSG_RHI_BACKEND", "opengl"); |
| 26 | #endif |
| 27 | |
| 28 | NetworkController networkController; |
| 29 | |
| 30 | QQuickView view; |
| 31 | view.setFormat(format); |
| 32 | view.rootContext()->setContextProperty("networkController", &networkController); |
| 33 | view.setResizeMode(QQuickView::SizeRootObjectToView); |
| 34 | view.setSource(QUrl("qrc:/PlanetsMain.qml")); |
| 35 | view.setColor("#000000"); |
| 36 | view.show(); |
| 37 | |
| 38 | return app.exec(); |
| 39 | } |