When trying to draw circles in webGl (You can answer the question even in openGl terms, I'll understand both), I came across the TRIANGLE_FAN flag when calling either glDrawArrays (with only a vertex buffer) or glDrawElements (with a vertex and index buffer). Since TRIANGLE_FAN expects the first point to be the 'hub" or "center" of the polygon and all other points are the outside points. So, the first thing that came to mind is to break out of my index buffer habit, as there seems not to be a lot of data that can be saved. But, does it make sense to use an index buffer in my case? Can you even use one? Which one saves more data and is more efficient? Any feedback would be appreciated. - Thank you
2 Answers
It could possibly make sense if you try to draw something like a huge polygon, or some sort of sphere, where the edges connect. This is really inefficient, since the index buffer is most probably going to be bigger than the saved space, but it is possible.
Conclusion: It is possible, but doesn't make sense for any to me known application.
You're generally better off using plain triangles and an index buffer to draw multiple fans (and other shapes) in a single draw call.
It's easier on the GPU/driver in terms of draw call and some drivers/GPUs have to break down the indexed fan into indexed triangles before drawing by regenerating the index buffer on the fly.
The small amount of memory space saved may not be worth the extra work the driver/GPU has to do.
Same applies to quads and indexed triangle strips.