Advertisement
Guest User

Untitled

a guest
Oct 8th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.79 KB | None | 0 0
  1. #include <QGuiApplication>
  2. #include <QQmlApplicationEngine>
  3. #include <QOpenGLContext>
  4.  
  5. void setSurfaceFormat()
  6. {
  7.     QSurfaceFormat format;
  8. #ifdef QT_OPENGL_ES_2
  9.     format.setRenderableType(QSurfaceFormat::OpenGLES);
  10. #else
  11.     if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
  12.         format.setVersion(4, 3);
  13.         format.setProfile(QSurfaceFormat::CoreProfile);
  14.     }
  15. #endif
  16.     format.setDepthBufferSize(24);
  17.     format.setSamples(4);
  18.     format.setStencilBufferSize(8);
  19.     QSurfaceFormat::setDefaultFormat(format);
  20. }
  21.  
  22. int main(int argc, char **argv)
  23. {
  24.     QGuiApplication app(argc, argv);
  25.     setSurfaceFormat();
  26.  
  27.     QQmlApplicationEngine engine(QUrl("qrc:/main.qml"));
  28.     if (engine.rootObjects().isEmpty())
  29.         return -1;
  30.     return app.exec();
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement