gl_VertexID broken? gtx970


i assume the vertex ID is supposed to be the i’th vertex of a draw(array/element/fixed function) call.

Specifically, when rendering one Triangle consisting of 3 Vertices and rendering color depending on the ID the following should work:


flat out vec3 colors[3];

if (gl_VertexID % 3 == 0)
colors[0] = vec3(1,0,0);

if (gl_VertexID % 3 == 1)
colors[1] = vec3(0,1,0);

if (gl_VertexID % 3 == 2)
colors[2] = vec3(0,0,1);


flat in vec3 colors[3];

out0 = colors[0] +colors[2]+colors[2];

where the color is 1.

However, only the last vertexID per triangle triggers.
The same applies when rendering a second triangle.
Only gl_VertexID % 3 == 2 has an effect.

I would appreciate some insight on this matter.
Best Regards

Edit: I was too hasty: I just learned about the provoking vertex, so never mind