learnopengl-qt3d
learnopengl-qt3d copied to clipboard
Issue with MacOS
Thanks for this very nice Qt3d material. I successfully run it under GNU/Linux but can't make it work with MacOS. Here is my log :
qml: [Resources] app:1:qrc:/
qml: [Resources] isGL33Core: 0, isGLES30: 1, isGLES20: 0.
qml: [Resources] assets:1:qrc:/
QOpenGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing.
ERROR: 0:8: 'varying' : syntax error: syntax error
*** Problematic Fragment shader source code ***
#define lowp
#define mediump
#define highp
#line 1
uniform highp float qt_Opacity;
uniform mediump float relativeSizeX;
uniform mediump float relativeSizeY;
uniform mediump float spread;
uniform lowp vec4 color;
varying highp vec2 qt_TexCoord0;
highp float linearstep(highp float e0, highp float e1, highp float x) {
return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
}
void main() {
lowp float alpha =
smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
}
***
No camera found and automatic aspect ratio requested
No Input Settings found, keyboard and mouse events won't be handled
It seems the shader variant is not correct but I couldn't see from where it is loaded. My Qt version is 5.7.1 and my OpenGL version is supposed to be 4.1 (from this kb https://support.apple.com/en-us/HT202823)
However glxinfo give me this feedback :
OpenGL vendor string: Intel Inc. OpenGL renderer string: Intel(R) Iris(TM) Graphics 6100 OpenGL version string: 2.1 INTEL-10.22.25 OpenGL shading language version string: 1.20
Thanks for your help.
This is a bug of QtQuickControl2 material theme: Its shadow shader is writing in OpenGL ES2 and your platform is detected as OpenGL ES3.x
It's quite interesting that the global context is set to GL(destktop), QtQuick still run in GLES context sometimes and in some part.
Change the theme to "Universal" (i.e the Windows one) may help.