I'm coding an OpenGL ES 1.1 app for Android and iPhone. The OpenGL ES engine lives in a shared library and is accessed via NDK on Android.
I'm looking to optimise my OpenGL performance. There's plenty of videos and resources out there, e.g.:
http://www.vizworld.com/2010/02/ngmocos-tim-omernick-optimizing-opengl-iphone/
OpenGL ES 2.0 : Seeking VBO Performance/Optimisation Tips For Many Moving Vertices
When are VBOs faster than "simple" OpenGL primitives (glBegin())?
https://gamedev.stackexchange.com/questions/1068/opengl-optimization-tips
But generally there are well known techniques that apply universally, such as:
- Use vertex buffer objects (VBOs)
- Minimise OpenGL state changes
- Use texture atlassing where possible to avoid having to select many different textures
Some techniques are, or may be, a bit more sensitive in their specifics, and may differ between Android and iPhone, and that's what I'm interested in. For example:
- Interleave your vertex data inside each vertex: e.g. vertex coord; texture coord; normal. Is there a preferred order of items in the interleaving?
- Pad out each vertex to the next multiple of some number of bytes. I see the number 32 bandied about, but have also see 4 or 8 in some places.
- Consider using a short or similar for each Vertex's coordinate, rather than a float
So my question is: what are the finer details of the magic optimisations such as the last list above that differ between Android and iPhone? Where they differ, what is the best strategy? Just use a value that suits both worlds? (Fine-tuning such details at runtime depending on the platform might be a bit over the top?)