diff options
Diffstat (limited to 'examples/qt3d/simplecustommaterial')
-rw-r--r-- | examples/qt3d/simplecustommaterial/SimpleMaterial.qml | 13 | ||||
-rw-r--r-- | examples/qt3d/simplecustommaterial/main.cpp | 19 |
2 files changed, 32 insertions, 0 deletions
diff --git a/examples/qt3d/simplecustommaterial/SimpleMaterial.qml b/examples/qt3d/simplecustommaterial/SimpleMaterial.qml index 0ad045e25..22cc028b0 100644 --- a/examples/qt3d/simplecustommaterial/SimpleMaterial.qml +++ b/examples/qt3d/simplecustommaterial/SimpleMaterial.qml @@ -99,6 +99,19 @@ Material { shaderProgram: gl3Shader } }, + // OpenGL 2.0 + Technique { + filterKeys: [forward] + graphicsApiFilter { + api: GraphicsApiFilter.OpenGL + profile: GraphicsApiFilter.NoProfile + majorVersion: 2 + minorVersion: 0 + } + renderPasses: RenderPass { + shaderProgram: es2Shader + } + }, // ES 2.0 Technique { filterKeys: [forward] diff --git a/examples/qt3d/simplecustommaterial/main.cpp b/examples/qt3d/simplecustommaterial/main.cpp index 392fe50ee..d841e7d19 100644 --- a/examples/qt3d/simplecustommaterial/main.cpp +++ b/examples/qt3d/simplecustommaterial/main.cpp @@ -50,9 +50,28 @@ #include <QGuiApplication> #include <QQuickView> +#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) { + setSurfaceFormat(); QGuiApplication app(argc, argv); QQuickView view; |