Debian Codegraph @

tests/benchmarks/Qt3DBench/main.cpp

raw symbols SCIP
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #if 0
5 // This one uses Scene3D
6 #include <QGuiApplication>
7 #include <QQuickView>
8 #include <QOpenGLContext>
9
10 int main(int argc, char **argv)
11 {
12 QGuiApplication app(argc, argv);
13
14 QSurfaceFormat format;
15 if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
16 //format.setVersion(3, 2);
17 format.setProfile(QSurfaceFormat::CoreProfile);
18 }
19 format.setDepthBufferSize(24);
20 format.setSamples(4);
21
22 QQuickView view;
23 view.resize(1280, 768);
24 view.setFormat(format);
25 view.setResizeMode(QQuickView::SizeRootObjectToView);
26 view.setSource(QUrl("qrc:/Qt3DBenchMain.qml"));
27 view.show();
28
29 return app.exec();
30 }
31
32 #else
33
34 #include <window.h>
35 #include <Qt3DRender/qrenderaspect.h>
36 #include <Qt3DInput/QInputAspect>
37 #include <Qt3DQuick/QQmlAspectEngine>
38
39 #include <QGuiApplication>
40 #include <QQmlContext>
41 #include <QQmlEngine>
42
43 int main(int argc, char* argv[])
44 {
45 QGuiApplication app(argc, argv);
46
47 Window view;
48 Qt3DCore::Quick::QQmlAspectEngine engine;
49
50 view.resize(1280, 768);
51 engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
52 engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
53 engine.aspectEngine()->initialize();
54 QVariantMap data;
55 data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
56 data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
57 engine.aspectEngine()->setData(data);
58 engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
59 engine.setSource(QUrl("qrc:/SphereView.qml"));
60
61 view.show();
62
63 return app.exec();
64 }
65
66 #endif