| |||
Home > Developing OpenGL ES Applications > Recommendations and best practices > Draw mode |
For large meshes, each vertex is typically included in several triangles. The number of times that such a vertex is processed depends on the function that performs the draw operation.
Using the API function glDrawElements
,
the attributes of one vertex have to be processed only once. The
alternative function, glDrawArrays
, causes
each set of vertex data to be transferred and processed each time
it is used in a triangle. For this reason, the most efficient way
to pass geometry data when using typical meshes, is usually with
indexed mode, using glDrawElements
.
Alternatively, restructure the mesh into triangle fans or
triangle strips, as this reduces the number of times each vertex
occurs in the vertex array. You can also use triangle fans or triangle strips
to reduce the number of indices transferred when glDrawElements
is
used.
By drawing a mesh with triangle fans or strips, it typically requires more draw calls, than when compared to using individual triangles. Because each draw call has some amount of processing overhead, splitting the mesh you could easily move the processing bottleneck from vertex processing to draw call overhead, eliminating the advantage of performing less vertex processing. See Identifying problems in applications for more information about bottlenecks.
Store vertex data tightly and in the order that it is to be used. This improves the effectiveness of the vertex cache, by minimizing the amount of data transferred from RAM to the vertex cache.