title: OpenGL 3/4 glVertexAttribPointer stride and offset miscalculation
body: <p>I am having a problem getting my vertex array pointed to properly:</p>
  
  <blockquote>
  <pre><code>const float vertices[] = {
  /* position */ 0.75f, 0.75f, 0.0f, 1.0f, /* color */ 1.0f, 0.0f, 0.0f, 1.0f,
  /* position */ 0.75f, -0.75f, 0.0f, 1.0f, /* color */ 0.0f, 1.0f, 0.0f, 1.0f,
  /* position */ -0.75f, -0.75f, 0.0f, 1.0f, /* color */ 0.0f, 0.0f, 1.0f, 1.0f, };
  
  ...
  
  glBindBuffer(GL_ARRAY_BUFFER, vertexBufferObject);
  glEnableVertexAttribArray(0);
  glEnableVertexAttribArray(1);
  glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
  glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 0, (void*)16);
  
  glDrawArrays(GL_TRIANGLES, 0, 3);
  
  glDisableVertexAttribArray(0);
  glDisableVertexAttribArray(1);
  </code></pre>
  </blockquote>
  
  <p>I do not understand how stride and offset work.
  What is the correct way of going about using <code>glVertexAttribPointer()</code> in my situation?</p>