summaryrefslogtreecommitdiffstats
path: root/examples/qt3d
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-04-25 08:54:55 +0200
committerPaul Lemire <paul.lemire@kdab.com>2017-04-25 09:42:01 +0000
commit56d83515f6d4546d8d5bf0ec603fa49f40c51a9d (patch)
tree23ed4bdfd250ed0f96469c6c8fb822cac504ab76 /examples/qt3d
parent85f2562428de462ad05516c754956d65faae7b78 (diff)
advancedcustommaterial: request proper GL format
Change-Id: I9a4f1882805892248aa9f6a4cf8d83a49acaeb0b Task-number: QTBUG-60288 Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'examples/qt3d')
-rw-r--r--examples/qt3d/advancedcustommaterial/WaterMaterial.qml4
-rw-r--r--examples/qt3d/advancedcustommaterial/main.cpp19
2 files changed, 21 insertions, 2 deletions
diff --git a/examples/qt3d/advancedcustommaterial/WaterMaterial.qml b/examples/qt3d/advancedcustommaterial/WaterMaterial.qml
index 5278d8752..2c5410bea 100644
--- a/examples/qt3d/advancedcustommaterial/WaterMaterial.qml
+++ b/examples/qt3d/advancedcustommaterial/WaterMaterial.qml
@@ -228,7 +228,7 @@ Material {
}
},
- // OpenGL 2.1
+ // OpenGL 2.0
Technique {
filterKeys: [ forward ]
graphicsApiFilter {
@@ -238,7 +238,7 @@ Material {
minorVersion: 0
}
renderPasses: RenderPass {
- shaderProgram: gl3Shader
+ shaderProgram: esShader
renderStates: [ alphaCoverage ]
}
},
diff --git a/examples/qt3d/advancedcustommaterial/main.cpp b/examples/qt3d/advancedcustommaterial/main.cpp
index 8b76e100c..9338ab4f4 100644
--- a/examples/qt3d/advancedcustommaterial/main.cpp
+++ b/examples/qt3d/advancedcustommaterial/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;