1

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 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the suggestions. Two follow-ups: 1. I'm thinking I could put the vertex data in a buffer texture like you suggested, and then send simplified geometry to the pipeline, such as a single line segment between the first and last vertices; do you see any reason this wouldn't work? 2. If I were to designate a vertex for the text, how would I create and submit the text tag to the GL pipeline? Since this is going to be happening to many different line strips, it seems like this would have to be done in the Vertex shader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.