error: GLSL 3.30 is not supported
-
I'm trying to learn qt-opengl by myself and has ran into a problem. I am following this tutorial with some modifications and everything compiles perfectly. However when I run I get the following message:
QOpenGLShader::compile(Vertex): 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES *** Problematic Vertex shader source code *** #version 330 core #define lowp #define mediump #define highp #line 2 layout(location = 0) in vec3 position; layout(location = 1) in vec3 color; out vec4 vColor; void mian() { gl_Position = vec4(position, 1.0); vColor = vec4(color, 1.0f); } *** QOpenGLShader::compile(Fragment): 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES *** Problematic Fragment shader source code *** #version 330 core #define lowp #define mediump #define highp #line 2 in vec4 vColor; out vec4 fColor; void main() { fColor = vColor; }
I am using Qt 5.7 on Ubuntu16.04
my 'glxinfo | grep 'version' has the following outputserver glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 Max core profile version: 3.3 Max compat profile version: 3.0 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.0 OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 OpenGL core profile shading language version string: 3.30 OpenGL version string: 3.0 Mesa 11.2.0 OpenGL shading language version string: 1.30 OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.2.0 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
I don't understand why it GLSL3.30 is not supported
-
@Wieland Initially I didn't have that. I was thinking maybe it's a good idea to use the core profile? Long story short, It still doesn't work. By the way, The difference of my code and the tutorial is that I uses QOpenGLWidget instead of QWindow for implementation.
-
Okay. Then try to explicitly set the default surface format, in main.cpp:
int main(int argc, char *argv[]) { QApplication a(argc, argv); QSurfaceFormat fmt; fmt.setVersion( 3, 3 ); fmt.setProfile( QSurfaceFormat::CoreProfile ); QSurfaceFormat::setDefaultFormat( fmt ); //...
(
#version 330
should default to#version 330 core
anyways) -
@Wieland Thank you for the elegant solution!! Moreover than that, I found that in my vertex file I miss typed
main
asmian