title: OpenGL performance: VBOs/Vertex shader vs. glEnableClientState/glVertexPointer and glMultMatrix vs glUniformMatrix
body: <p>Im fairly new to OpenGL. Ive just started learning about shaders, particularly the vertex and fragment shaders.  My understanding is that when things are done through the shaders you can gain a pretty significant performance increase, because the shader runs on the GPU.</p>
  
  <p>However, I've tried doing some research into this topic and I seem to be finding some mixed opinions on the matter, at least in regards to the vertex shader. </p>
  
  <p>What is the major difference between rendering an object like below and using calls like <strong>glMultMatrixd</strong> for my transformations:</p>
  
  <pre><code>    glEnableClientState(GL_VERTEX_ARRAY);
      glEnableClientState(GL_NORMAL_ARRAY);
  
      glVertexPointer(3, GL_FLOAT, 0, &amp;vertices[0]);
      glNormalPointer(GL_FLOAT, 0, &amp;normals[0]);
  
      glDrawArrays(GL_TRIANGLES, 0, vertices.size() / 3);
  
      glDisableClientState(GL_VERTEX_ARRAY);
      glDisableClientState(GL_NORMAL_ARRAY);
  </code></pre>
  
  <p>vs using a VAO/VBO setup like below where I set my transformation matrices to Uniform variables in the shader and do the transformation there.  </p>
  
  <pre><code>glBindVertexArray(vaoHandle);
  glBindBuffer(GL_ARRAY_BUFFER, bufferHandle[0]);
  
  
  glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(float), vertices.data(), GL_STATIC_DRAW);
  
  glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
  glEnableVertexAttribArray(0);
  
  glBindBuffer(GL_ARRAY_BUFFER, bufferHandle[1]);
  glBufferData(GL_ARRAY_BUFFER, normals.size() * sizeof(float), normals.data(), GL_STATIC_DRAW);
  
  glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
  glEnableVertexAttribArray(1);
  </code></pre>
  
  <p>.....</p>
  
  <pre><code>glBindVertexArray(vaoHandle);
  glDrawArrays(GL_TRIANGLES, 0, vertices.size() / 3);
  </code></pre>
  
  <p>Just a heads up...I dont care about whats wrong with the code below.  Again, I just wanna know if there is in fact a performance difference and why? Whats going on underneath the hood for both these approaches? WHy would one be faster/slower then the other?  And same goes for the transformations.  Why would doing one in a vertex shader with a uniform be faster then using glMultMatrix?</p>