1
votes

I wanted to use a GLSL geometry shader to look at a line strip and determine the place to put a textured annotation, taking into account the current ModelView. It seems I'm limited to only getting 4 vertices per invokation (using GL_LINE_STRIP_ADJACENCY), but what I need is the entire line strip to evaluate.

I could use some other primitive type (such as a Multi-point, if there is an equivalent in GL), but the important point is I want to consider all the geometry, not just a portion.

Is there an extension of come kind that would provide additional vertices to the Geometry shader? Or is there a better way to do this other than using the Geometry shader?

1

1 Answers

3
votes

There is no mechanism that will give you access to an entire rendered primitive stream. Primitives can be arbitrarily large, so they can easily blow past any reasonable internal buffer sizes that GPUs have. Thus implementing this would be impractical.

You could bind your array as a buffer texture and just read the data from there. But that's going to be exceedingly slow, since every GS invocation is going to have to process hundreds of vertices. That's not exactly taking advantage of GPU parallelism.

If you just want to put a text tag near something, you should designate a vertex or something as being where annotations should go.