blob: b2e0deb91956892cad317a997926e6c28413dd61 (
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
32
33
34
35
36
37
38
|
// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QGuiApplication>
#include <QQuickView>
#include <QOpenGLContext>
void setSurfaceFormat()
{
QSurfaceFormat format;
#if QT_CONFIG(opengles2)
format.setRenderableType(QSurfaceFormat::OpenGLES);
#else
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
format.setVersion(4, 3);
format.setProfile(QSurfaceFormat::CoreProfile);
}
#endif
format.setDepthBufferSize(24);
format.setSamples(4);
format.setStencilBufferSize(8);
QSurfaceFormat::setDefaultFormat(format);
}
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
setSurfaceFormat();
QQuickView view;
view.resize(1920, 1080);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
}
|