I am trying to write a geometry shader that will take as input the four vertices that define a tetrahedron (input as GL_ POINTS), and use the group of four points to draw the four faces of the tetrahedron. So I have a display function that emits the four vertices, and a geometry shader that should loop
for (i = 0; i < gl_VerticesIn; i += 4)
a = gl_PositionIn [i];
b = gl_PositionIn [i+1];
etc. However, this gives me array index out of bounds errors, and when I try some debugging, it appears that gl_VerticesIn == 1!
The only explanation I can think of is that gl_VerticesIn is misnamed, and it really ought to be called something like gl_VerticesInPrimitive - that is, it’s 1 for points, 2 for lines, etc. But if that’s the case, not only have I wasted a good bit of time discovering it (because I can’t find it documented anywhere), but I’ve no idea how to go about actually doing what I need to do: process groups of 4 vertices.