summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/controls/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d/controls/main.cpp')
-rw-r--r--examples/qt3d/controls/main.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/examples/qt3d/controls/main.cpp b/examples/qt3d/controls/main.cpp
index 57b145a57..b0792961c 100644
--- a/examples/qt3d/controls/main.cpp
+++ b/examples/qt3d/controls/main.cpp
@@ -3,19 +3,29 @@
#include <QGuiApplication>
#include <QQuickView>
+#include <QQmlContext>
#include <Qt3DRender/qt3drender-config.h>
int main(int argc, char **argv)
{
- QGuiApplication app(argc, argv);
-#if !QT_CONFIG(qt3d_rhi_renderer)
- qputenv("QSG_RHI_BACKEND", "opengl");
-#endif
+ 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();