title: OpenGL on Android versus iOS: optimisations, and where they differ
body: <p>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.</p>
  
  <p>I'm looking to optimise my OpenGL performance. There's plenty of videos and resources out there, e.g.:</p>
  
  <p><a href="http://www.vizworld.com/2010/02/ngmocos-tim-omernick-optimizing-opengl-iphone/" rel="nofollow noreferrer">http://www.vizworld.com/2010/02/ngmocos-tim-omernick-optimizing-opengl-iphone/</a></p>
  
  <p><a href="http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Performance/Performance.html#//apple_ref/doc/uid/TP40008793-CH105" rel="nofollow noreferrer">http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Performance/Performance.html#//apple_ref/doc/uid/TP40008793-CH105</a></p>
  
  <p><a href="http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html" rel="nofollow noreferrer">http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html</a></p>
  
  <p><a href="https://stackoverflow.com/questions/7243518/opengl-es-2-0-seeking-vbo-performance-optimisation-tips-for-many-moving-vertic">OpenGL ES 2.0 : Seeking VBO Performance/Optimisation Tips For Many Moving Vertices</a></p>
  
  <p><a href="https://stackoverflow.com/questions/430555/when-are-vbos-faster-than-simple-opengl-primitives-glbegin">When are VBOs faster than &quot;simple&quot; OpenGL primitives (glBegin())?</a></p>
  
  <p><a href="https://gamedev.stackexchange.com/questions/1068/opengl-optimization-tips">https://gamedev.stackexchange.com/questions/1068/opengl-optimization-tips</a></p>
  
  <p>But generally there are well known techniques that apply universally, such as:</p>
  
  <ul>
  <li>Use vertex buffer objects (VBOs)</li>
  <li>Minimise OpenGL state changes</li>
  <li>Use texture atlassing where possible to avoid having to select many different textures</li>
  </ul>
  
  <p>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:</p>
  
  <ul>
  <li>Interleave your vertex data inside each vertex: e.g. vertex coord; texture coord; normal. Is there a preferred order of items in the interleaving?</li>
  <li>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.</li>
  <li>Consider using a short or similar for each Vertex's coordinate, rather than a float</li>
  </ul>
  
  <p>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?)</p>