Reputation: 232
I have a bunch of polygon data that I want to draw. I pulled out that drawing code so that it currently looks like this
for (int Index = 0; Index < Count; Index++) {
glDrawArrays(GL_TRIANGLE_FAN, Index * 4, 4);
}
I have a giant one dimensional array filled with multiple triangles, a new triangle every 4 vertices. Are there any OpenGL functions that I can replace this entire loop with so that I don't have the overhead of each glDrawArrays call? glMultiDrawArrays is sort of what I want, except I don't need a different first (well, I need a different first, but multiplied by a constant) and count each time.
I thought something like glVertexAttribDivisor would work, but nothing was drawing after I added it, I'm not completely sure if it works without instancing either.
EDIT: I am using a triangle fan, and I am buffering the vertices every frame.
Upvotes: 3
Views: 1514
Reputation: 52082
glDrawElements()
+ GL_PRIMITIVE_RESTART
& glPrimitiveRestartIndex()
.
Upvotes: 2