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.
Thanks for the reference. I’ve seen it (or similar) before, and have tried to read it, but since it’s mostly snippets of “add to section xxx” I never managed to glean much useful information. I suppose it works for its intended purpose - a reference for implementors - but as an introduction it leaves something to be desired.
I did try the lines with adjacency, and it seems to work for this problem.
Nope, the extension registry is actually very useful, you just have to know where to look. Skip the documentation modifications sections and you’ll find the relevant information.
What man files? I’d like to have some, but on my system (NVidia) there’s nothing beyond standard OpenGL functions as of version 1.4 or so. Not just GLSL, but things like framebuffer object functions…
P.S. You’ll get used to the reading the specs. If I can get used to them, anyone can.
Yeah, they say you can get used to hanging, if you hang long enough
I’m sure I didn’t understand all that on a quick readthrough. Maybe when things slow down a bit (I hope!) in a couple of weeks, I’ll have time to puzzle through them. I did note one worrisome comment at the end: “The modular stylesheets include a manpages stylesheet but nobody has tried it yet.” So these are supposed to be man pages, but no one has actually tried generating them?