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;
if (gl_VertexID % 3 == 0)
colors = vec3(1,0,0);
if (gl_VertexID % 3 == 1)
colors = vec3(0,1,0);
if (gl_VertexID % 3 == 2)
colors = vec3(0,0,1);
flat in vec3 colors;
out0 = colors +colors+colors;
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.
Edit: I was too hasty: I just learned about the provoking vertex, so never mind