title: OpenGL How Many VAOs
body: <p>I am writing an OpenGL3+ application and have some confusion about the use of VAOs. Right now I just have one VAO, a normalised quad set around the origin. This single VAO contains 3 VBOs; one for positions, one for surface normals, and one GL_ELEMENT_ARRAY_BUFFER for indexing (so I can store just 4 vertices, rather than 6).</p>
  
  <p>I have set up some helper methods to draw objects to the scene, such as <code>drawCube()</code> which takes position and rotation values and follows the procedure;</p>
  
  <ul>
  <li>Bind the quad VAO.</li>
  <li>Per cube face:
  
  <ul>
  <li>Create a model matrix that represents this face.</li>
  <li>Upload the model matrix to the <code>uniform mat4 model</code> vertex shader variable.</li>
  <li>Call <code>glDrawElements()</code> to draw the quad into the position for this face.</li>
  </ul></li>
  </ul>
  
  <p>I have just set about the task of adding per-cube colors and realised that I can't add my color VBO to the single VAO as it will change with each cube, and this doesn't feel right.</p>
  
  <p>I have just read the question; <a href="https://stackoverflow.com/questions/8923174/opengl-vao-best-practices">OpenGL VAO best practices</a>, which tells me that my approach is wrong, and that I should use more VAOs to save the work of setting the whole scene up every time.</p>
  
  <p><em>How many VAOs should be used?</em> Clearly my approach of having 1 is not optimal, should there be a VAO for every static surface in the scene? What about ones that move?</p>
  
  <p><em>I am writing to a uniform variable for each vertex, is that correct?</em> I read that <code>uniform</code> shader variables should not change mid-frame, if I am able to write different values to my <code>uniform</code> variable, how do uniforms differ from simple <code>in</code> variables in a vertex shader?</p>