GLSL version directive

Started by
4 comments, last by Aroidzap 11 years, 8 months ago
Adding version directive to my shaders causes that they not work. I tried adding all versions. None works.
#version 110
#version 120
#version 130 ... 140,150,330,400,410,420,430

Without this directive, shaders works normally. Any suggestion?
Advertisement
What error message does the driver return via glGetShaderInfoLog when the compile fails?
Ehm... I have not implemented that yet rolleyes.gif (glGetShaderInfoLog) ... I will post results in few hours wink.png
so... I've got errors like this:

error C7533: global variable gl_Normal is deprecated after version 120
error C7533: global variable gl_Vertex is deprecated after version 120
...
error C7011: implicit cast from "float" to "vec4"
...
error C7565: assignment to varying ...
error C7564: assignment to attribute ...
attribute vec3 tangent;
...
tangent = gl_NormalMatrix * tangent;

...

than some warnings :

warning C7555: 'varying' is deprecated, use 'in/out' instead
warning C7555: 'attribute' is deprecated, use 'in/out' instead
...
All of these should be pretty obvious. You need to pick a version of shaders you want to work for and then read up on how to work with them. You cannot claim to use modern (or at least newer) shader versions and use language elements that were deprecated years ago.

I would be very careful when googling for tutorials, a lot them are very old and/or were not very good to begin with. If the tutorial does not explain properly for which version it is, it will probably cause you more pain in the long run. Reading the GLSL specification might be the best solution to get a good and solid grip on the language, but the documents might be a bit long for the impatient. The Wikipedia page for GLSL has the specifications for older and newer versions accessible from one spot (http://en.wikipedia.org/wiki/Glsl), the official site only has the latest version easily linked: http://www.opengl.org/documentation/glsl/
Thanks smile.png

This topic is closed to new replies.

Advertisement