Reputation: 3133
Background: I am developing an application that essentially draws a huge 3D graph of nodes and edges. The nodes are drawn as instanced cubes while the edges are drawn with GL_LINE
and expanded with a geometry shader into 3D volumetric "lines" made of triangle strips. Currently, I am performing this expansion every time I redraw the edges. However, as my graph is entirely static (nodes can not move and thus neither can the edges), I figure that I only need to expand the GL_LINE
definitions into triangle strips once, capture the expanded vertices into a buffer (using Tranform Feedback), and then from that point on draw the edges using those captured vertices with glMutliDrawArrays
using a primitive type of GL_TRIANGLE_STRIP
.
Question: All of these volumetric lines I am drawing contain 10 vertices. However, glMultiDrawArrays
requires an array of starting indices and count sizes that essentially describe the start point and count (in elements) of each primitive. As none of my primitives vary in size, I would be making an seemingly unnecessary list of starting indices & counts. Is there any functionality OpenGL provides that would allow me to simply specify a stride (in elements) at which primitive restart would occur?
Upvotes: 3
Views: 906
Reputation: 474376
There is no such function, but for your needs, you don't need one. Transform feedback cannot output triangle strips. It outputs only basic primitives: individual points, lines, or triangles. That's why glBeginTransformFeedback
only takes GL_POINTS
, GL_LINES
, or GL_TRIANGLES
.
All you have to do is render all of your edges at once, collect the results into a single buffer via feedback, and later render the entire thing with a single call to glDrawArrays
.
Upvotes: 3