Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QGuiApplication>
- #include <QQmlApplicationEngine>
- #include <QOpenGLContext>
- void setSurfaceFormat()
- {
- QSurfaceFormat format;
- #ifdef QT_OPENGL_ES_2
- 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();
- QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
- if (engine.rootObjects().isEmpty())
- return -1;
- return app.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement