title: OpenGL vertex arrays throw invalid operation error
body: <p>I've recently started using OpenGL and LWJGL but ever since I tried to mess with/add vertex array objects, I've been getting the same error over and over: </p>
  
  <p>GL_INVALID_OPERATION</p>
  
  <p>I am having a hard time understanding why but I managed to pin down to problem to these methods:</p>
  
  <pre><code>glEnableClientState(GL_VERTEX_ARRAY);
  vao = glGenVertexArrays();
  
  glBindVertexArray(vao);
  glEnableVertexAttribArray(vao);     
  glVertexAttribPointer(0, count, GL_FLOAT, false, Float.SIZE * 2, 0);
  
  glBindVertexArray(0);
  </code></pre>
  
  <p>...so basically anything that has to do with vertex arrays throws this error. If anyone could point out what exactly I am doing wrong, that would be great. This is the rest of my code:</p>
  
  <pre><code>import static org.lwjgl.opengl.GL11.*;
  import static org.lwjgl.opengl.GL15.*;
  import static org.lwjgl.opengl.GL20.*;
  import static org.lwjgl.opengl.GL30.*;
  
  import java.nio.FloatBuffer;
  import java.nio.IntBuffer;
  
  import org.lwjgl.BufferUtils; 
  
  public class Model {
  
      private int count;
      private int ibo, vao;
  
      public Model(float[] vertices, int[] indices) {
  
          count = indices.length;
  
          glEnableClientState(GL_VERTEX_ARRAY);
          vao = glGenVertexArrays();
  
          glBindVertexArray(vao);
          glEnableVertexAttribArray(vao);
          glVertexAttribPointer(0, count, GL_FLOAT, false, Float.SIZE * 2, 0);
  
          glBindVertexArray(0);
  
          FloatBuffer vBuffer = BufferUtils.createFloatBuffer(vertices.length);
          vBuffer.put(vertices).flip();
  
          int vbo = glGenBuffers();
          glBindBuffer(GL_ARRAY_BUFFER, vbo);
          glBufferData(GL_ARRAY_BUFFER, vBuffer, GL_STATIC_DRAW);
  
          IntBuffer iBuffer = BufferUtils.createIntBuffer(indices.length);
          iBuffer.put(indices).flip();
  
          ibo = glGenBuffers();
          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
          glBufferData(GL_ELEMENT_ARRAY_BUFFER, iBuffer, GL_STATIC_DRAW);
  
          glBindBuffer(GL_ARRAY_BUFFER, 0);
          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
  
      }
      public void draw() {
  
          glBindVertexArray(vao);
          glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
  
          glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, 0);
  
      }
  }
  </code></pre>