I just downloaded the "Optimizing OpenGL for iPhone" lecture from Stanford University (you will find it at iTunes U), where Tim Omernick from ngmoco talked a lot about batching all drawing operations into one call. It however requires you to do all the matrix multiplications such as rotations and translations manually on the vertices instead of changing GL state with glTranslate and glRotate for each object.
I find it weird that it would cost less to do all the matrix multiplications manually on the vertices instead of letting OpenGL take care of it. Perhaps it depends on how complex the mesh is? Tim Omernick showed that it is better to combine many simple objects into one big array and calculate all the translations and rotations manually, than using glTranslate/glRotate operations and calling glDrawArrays() for each object. I wonder if that is still the case for complex objects? If you have a few but very complex mesh objects, you will also have few glTranslate/glRotate and glDrawArrays() calls for each frame, in which case it might be better to let OpenGL do it all?
Does anyone have any insight into this? Should we always combine all the objects into one big array and make just one glDrawArrays() call per frame, or does it depend on the complexity of the scene?
|