Hi all,
I am developing a 2D game for the iPhone (thanks Mike for getting me started with your excellent tutorials).
The game displays numerous sprites from the same sprite sheet on screen at any one time. To improve the efficiency of this I re-worked some of Mike's examples to create a render manager that batched up all the sprites being rendered from one texture and submit all vertex and texture data in one glDrawElements() call.
As I have been improving the look of the game I now want to rotate the sprites based on their movement direction (i.e. my sprite are drawn facing up the screen, if the sprite is moving to the right of the screen then I want to rotate the sprite by 90 degrees so that it is facing right). If I were drawing each sprite as a individual call to glDrawElements() then I could change the OpenGL rotation state using glRotatef() to handle this but as I am drawing all the sprites as a batch I am having to calculate the vertex rotation myself in code (which means it's all being done on the CPU).
Now I'm worried that the performance improvement from making a single glDrawElements() call likely to be negated by the cost of performing the sprite rotation on the CPU rather than the GPU?
In a nutshell:
1) Should I leave things as they are
2) Should I switch back to drawing the sprites individually
3) Is there some other mechanism I could use to still do the rotation calcs on the GPU while still batch drawing the sprites...
Thanks in advance for any insights...
Paul


