Iphone – Is glDrawElements() more efficient than glDrawArrays() when there are many duplicate vertices

iphoneopengl-es

I'm trying to squeeze some performance increases out of my iPhone OpenGL ES application. According to Instruments, my tiler utilization is near 100% most of the time, and my FPS is about 24. I'd like to get my FPS up over 30. I can get there by converting from GL_FLOAT to GL_SHORT, but that presents some fairly daunting technical problems for me at the moment. I'd rather not go there.

So, I'm considering switching from glDrawArrays() to glDrawElements(). I have 35 meshes made up of 708 vertices, but a lot of those vertices are shared between faces. I am texture mapping but the mesh is mostly uniform in color. The faces that require special texturing will be left as is.

Let's say I can cut the number of vertices in half. Let's also say that I also organize my geometry in a way that makes sense for the iPhone: say, using Imagination Technologies PVRTTriStrip tool. Ignoring the small amount of extra memory for the index array, that means I've roughly cut the memory bandwidth in half so I should see a fairly nice performance increase.

Is this true, or am I missing or misunderstanding something? Advice is appreciated.

Best Answer

In case anyone is interested, I went ahead and tried this, without the PVRTTriStrip tool portion. All testing was done on an iPhone 3G. I was able to scale my vertices down from 708 to 113. And since I'm under 255, I'm using GLubyte as my index type. So, I went from:

35 * (708 * 32) = ~774K

To:

35 * (113 * 32 + 708 * 1) = ~148K

Which reduced my total memory bandwidth to under 20% of what it was. My FPS increased to ~34. So, I saw about a 42% improvement in FPS. Overall, I'm pretty happy. I think there's more to be gained, but I have bigger fish to fry now.

Also, I filtered out a bunch of degenerate triangles (not the useful kind) to get my index count down to 522, from 708. From that I saw an increase to ~40 FPS from the ~34 FPS I was seeing.

Related Topic