advancedcustommaterial: request proper GL format

Change-Id: I9a4f1882805892248aa9f6a4cf8d83a49acaeb0b
Task-number: QTBUG-60288
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
This commit is contained in:
Paul Lemire 2017-04-25 08:54:55 +02:00
parent 85f2562428
commit 56d83515f6
2 changed files with 21 additions and 2 deletions

View File

@ -228,7 +228,7 @@ Material {
} }
}, },
// OpenGL 2.1 // OpenGL 2.0
Technique { Technique {
filterKeys: [ forward ] filterKeys: [ forward ]
graphicsApiFilter { graphicsApiFilter {
@ -238,7 +238,7 @@ Material {
minorVersion: 0 minorVersion: 0
} }
renderPasses: RenderPass { renderPasses: RenderPass {
shaderProgram: gl3Shader shaderProgram: esShader
renderStates: [ alphaCoverage ] renderStates: [ alphaCoverage ]
} }
}, },

View File

@ -50,9 +50,28 @@
#include <QGuiApplication> #include <QGuiApplication>
#include <QQuickView> #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) int main(int argc, char **argv)
{ {
setSurfaceFormat();
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
QQuickView view; QQuickView view;