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.
glDrawElements() + GL_PRIMITIVE_RESTART & glPrimitiveRestartIndex().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With