Reputation: 39881
I want to draw a triangle fan. I wonder if it takes 1 draw call or more. I don't think this is important, but I draw with OpenGL ES.
Upvotes: 0
Views: 193
Reputation: 54572
OpenGL has a GL_TRIANGLE_FAN
primitive type. So you can draw a triangle fan with a single draw call:
glDrawArrays(GL_TRIANGLE_FAN, ...);
glDrawElements(GL_TRIANGLE_FAN, ...);
The first vertex defines the "origin" of the fan. If you have n
vertices for a triangle fan, there will be n - 2
triangles drawn with the following vertices:
0, 1, 2
0, 2, 3
0, 3, 4
...
0, n - 2, n - 1
Upvotes: 2
Reputation: 30489
From user point of view, you need just 1 draw call.
Internall for GPU or software renderer, this is implementation dependent whether the a particular implementation would take 1 or more draw calls.
On all GPUs known to me, we prepare just 1 draw stream which is sent to GPU and GPU draws it in 1 burst.
Upvotes: 1