title: How important is alignment in opengl vertex data in iOS
body: <p>The OpenGL ES Programming guide discusses that you should avoid misaligned vertex data and gives an example of aligning the data to 4 byte blocks.</p>
  
  <p><a href="http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesforWorkingwithVertexData/TechniquesforWorkingwithVertexData.html#//apple_ref/doc/uid/TP40008793-CH107-SW1" rel="noreferrer">OpenGL ES Programming Guide</a></p>
  
  <p><img src="https://i.stack.imgur.com/EPo15.jpg" alt="Misaligned vs Aligned vertex data"></p>
  
  <p>However in most demo material and tutorials I've found online I don't see anyone doing this. Example below is from a demo project on 71 Squared:</p>
  
  <pre><code>static const SSTexturedVertexData3D EnemyFighterVertexData[] = {
      {/*v:*/{1.987003, -0.692074, -1.720503}, /*n:*/{0.946379, -0.165685, -0.277261}, /*t:*/{0.972816, 0.024320}},
  </code></pre>
  
  <p>And how would you do it anyway? Add a dummy 0.0 to the v and n and 2 of them to the t?</p>
  
  <p>My guess is that if you're only loading the vertex data once per app it wouldn't matter much but if your binding and rebinding to different arrays on each rendered frame it would matter.  My plan is to combine all my arrays into one anyway, but I'm curious.</p>