summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/examples-common/qt3dquickwindow.cpp
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2016-02-11 21:06:09 +0000
committerMike Krus <mike.krus@kdab.com>2016-02-19 17:11:38 +0000
commite235efeb4ab24b8041583f5ab4e74bb7fea7a45b (patch)
treefc5ad8037dd5a4e1d91d30ae8ed833b09c8aa602 /examples/qt3d/examples-common/qt3dquickwindow.cpp
parent0935bc1ce9256232c8720071265baf975ab74956 (diff)
Set Context Format
In the examples, defer the creation of the various qt3d bits until after the default format is set. This way it will be picked up by qt3d and all contexts will have the same format. Maybe the MacOS QPA should be changed to always create the highest possible OpenGL context rather than sticking to 2.0 by default. Change-Id: I33079c0328e0edd9c6c6b01fba7283d019880594 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/qt3d/examples-common/qt3dquickwindow.cpp')
-rw-r--r--examples/qt3d/examples-common/qt3dquickwindow.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/examples/qt3d/examples-common/qt3dquickwindow.cpp b/examples/qt3d/examples-common/qt3dquickwindow.cpp
index b88884270..f43df0bd8 100644
--- a/examples/qt3d/examples-common/qt3dquickwindow.cpp
+++ b/examples/qt3d/examples-common/qt3dquickwindow.cpp
@@ -66,10 +66,10 @@ QT_BEGIN_NAMESPACE
Qt3DQuickWindow::Qt3DQuickWindow(QWindow *parent)
: QQuickWindow(parent)
- , m_engine(new Qt3DCore::Quick::QQmlAspectEngine)
- , m_renderAspect(new Qt3DRender::QRenderAspect)
- , m_inputAspect(new Qt3DInput::QInputAspect)
- , m_logicAspect(new Qt3DLogic::QLogicAspect)
+ , m_engine(Q_NULLPTR)
+ , m_renderAspect(Q_NULLPTR)
+ , m_inputAspect(Q_NULLPTR)
+ , m_logicAspect(Q_NULLPTR)
, m_initialized(false)
, m_cameraAspectRatioMode(AutomaticAspectRatio)
{
@@ -86,8 +86,14 @@ Qt3DQuickWindow::Qt3DQuickWindow(QWindow *parent)
format.setSamples(4);
format.setStencilBufferSize(8);
setFormat(format);
+ QSurfaceFormat::setDefaultFormat(format);
create();
+ m_engine.reset(new Qt3DCore::Quick::QQmlAspectEngine);
+ m_renderAspect = new Qt3DRender::QRenderAspect;
+ m_inputAspect = new Qt3DInput::QInputAspect;
+ m_logicAspect = new Qt3DLogic::QLogicAspect;
+
m_engine->aspectEngine()->registerAspect(m_renderAspect);
m_engine->aspectEngine()->registerAspect(m_inputAspect);
m_engine->aspectEngine()->registerAspect(m_logicAspect);