summaryrefslogtreecommitdiffstats
path: root/tests/manual/tessellation-modes/main.cpp
blob: 329beb8ac8da9c86db15caa1f12029e8cedb244d (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
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "tessellatedquadmesh.h"
#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <Qt3DQuick/QQmlAspectEngine>
#include <QGuiApplication>
#include <qqml.h>
#include <QQmlContext>
#include <QQmlEngine>

int main(int argc, char* argv[])
{
    QGuiApplication app(argc, argv);

    Qt3DExtras::Quick::Qt3DQuickWindow view;
    // Register our custom types
    qmlRegisterType<TessellatedQuadMesh>("Qt3D.Examples", 1, 0, "TessellatedQuadMesh");

    // Expose the window as a context property so we can set the aspect ratio
    view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);

    // There should be some synchronising mechanism to make sure
    // the source is set after all aspects have been completely initialized
    // Otherwise we might encounter cases where an Aspect's QML elements have
    // not yet been registered
    view.setSource(QUrl("qrc:/main.qml"));
    view.show();

    return app.exec();
}