I use a QOpenGLWidget
on my Qt 5.7 app, under MacOS 10.12, with an Intel GPU.
I try to request core profiles using
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(format);
as suggested in http://doc.qt.io/qt-5/qopenglwidget.html
Now, when I do this, I get lots of shader/compilation errors, such as
QOpenGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing.
*** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp
#line 1
lowp vec4 srcPixel();
void main()
{
gl_FragColor = srcPixel();
}
lowp vec4 srcPixel()
{
return vec4(0.98, 0.06, 0.75, 1.0);
}
Not that I did not write nor compiled any of these shaders: they are all from Qt. I've made some research already and found out that this has to do with Intel GPU drivers/OpenGL implementation from Intel, which does not allow the first line not to be #version
.
But is this expected from Qt?? Is there any way I could solve this?