As we all get to know eventually, the specification is one thing and the implementation is another. Most of bugs we cause ourselves, but sometimes that's not the case.
I believe it'd be useful to make a small list of:
Please remember to always post the relevant graphics card and driver version.
Let me start:
If in your vertex shader you have any attribute
(in
) variable whose name is lexically after gl_
, then you cannot use built-in attributes, namely gl_VertexID
and gl_InstanceID
. If you try, the shader won't work (blank screen, likely).
Only available with GLSL 3.3 and up, or with the GL_ARB_explicit_attrib_location extension.
Define any attribute's location explicitly to be equal to 0, by appending layout(location=0)
to its declaration in the vertex shader. You may, but don't need to use this for other attributes; the important thing is that ANY attribute needs to have location equal to 0. After you do that, the naming is no longer important.
Use a name convention which requires you to name your attribute variables starting with a_
, which won't hurt your code readability and will make all of them be lexically before gl_
(safe zone).