Skip to content
Advertisement

Can not compile shaders with Linux/Mesa

I have a OpenGL 3.0 application which works well when it is used with Windows. My shader programs all start with

#version 130 coren

Now when I stwich over to linux with OpenGL 3.0 Mesa 18.0.5, compiling of these shaders fails with error message

Vertex shader failed: 0:1(10): error: illegal text following version number

What could be the problem here? It is definitely OpenGL 3.0 which should support GLSL 1.3 – what illegal text is it complaining about?

Advertisement

Answer

#version 130 core

This version number simply does not exist. OpenGL profiles like core and compatibility were introduced in OpenGL 3.2, together with GLSL 1.50.

The correct version directive for GLSL 1.30 (from OpenGL 3.0) is just

#version 130

see section “3.3 Preprocessor” of the GLSL 1.30 Specification:

Shaders should declare the version of the language they are written to. The language version a shader is written to is specified by

#version number

where number must be a version of the language, following the same convention as __VERSION__ above. The directive #version 130 is required in any shader that uses version 1.30 of the language. Any number representing a version of the language a compiler does not support will cause an error to be generated.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement