Elmi
Elmi

Reputation: 6193

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 core\n

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?

Upvotes: 1

Views: 1187

Answers (1)

derhass
derhass

Reputation: 45332

#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.

Upvotes: 4

Related Questions