title: OpenGL 3.x - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER) and VAOs
body: <p>I have a method for initializing my VBO/VAO:</p>
  
  <pre><code>        glBindBuffer(GL_ARRAY_BUFFER, mVBO_VertexShader);
          glBufferData(GL_ARRAY_BUFFER, sizeof(vertexPositions), vertexPositions, GL_STATIC_DRAW);
          glBindBuffer(GL_ARRAY_BUFFER, 0);
  
          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
          glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indexData), indexData, GL_STATIC_DRAW);
          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
  
  
          // setup VAO
          glBindVertexArray(mVAO);
  
          glBindBuffer(GL_ARRAY_BUFFER, mVBO_VertexShader);
          glEnableVertexAttribArray(0);
          glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
  
          glBindBuffer(GL_ARRAY_BUFFER, 0);
          glBindVertexArray(0);
  </code></pre>
  
  <p>And then a separate method for drawing;</p>
  
  <pre><code>    glBindVertexArray(mVAO);
      glDrawElements(GL_TRIANGLES, 12, GL_UNSIGNED_SHORT, &amp;mIndexBuffer);
      glBindVertexArray(0);
  </code></pre>
  
  <p>Do I need to unbind the <code>GL_ELEMENT_ARRAY_BUFFER</code> after my call to <code>glDrawElements</code> or is its state 'tied' to the VAO? (So if I unbind the VAO, the <code>GL_ELEMENT_ARRAY_BUFFER</code> will also be unbound)?  </p>