title: glDrawElements is called with VERTEX_ARRAY client state disabled
body: <p>I'm trying to draw a sphere in OpenGL ES 2.0+ on Android, and I'm seeing the following error in Logcat:</p>
  
  <blockquote>
    <p>glDrawElements is called with VERTEX_ARRAY client state disabled!</p>
  </blockquote>
  
  <p>I looked at the documentation for this call and I can't see anything I might be doing wrong. From the error it sounds like I'm missing some setup somewhere.</p>
  
  <p>Here's my VertexBuffer class where I'm doing the setup:</p>
  
  <pre><code>public class VertexBuffer {
  
      private final int mBufferId;
  
      public VertexBuffer(float[] vertexData) {
          // Allocate a buffer
          final int[] buffers = new int[1];
          glGenBuffers(buffers.length, buffers, 0);
          if (buffers[0] == 0) {
              throw new RuntimeException("Could not create a new VBO");
          }
          mBufferId = buffers[0];
  
          // Bind to the buffer
          glBindBuffer(GL_ARRAY_BUFFER, mBufferId);
  
          // Transfer data to native memory
          FloatBuffer vertexArray = ByteBuffer
              .allocateDirect(vertexData.length * BYTES_PER_FLOAT)
              .order(ByteOrder.nativeOrder())
              .asFloatBuffer()
              .put(vertexData);
          vertexArray.position(0);
  
          // Transfer data from native memory to the GPU buffer
          glBufferData(GL_ARRAY_BUFFER, vertexArray.capacity() * BYTES_PER_FLOAT, vertexArray, GL_STATIC_DRAW);
  
          // IMPORTANT: Unbind from the buffer when we are done with it
          glBindBuffer(GL_ARRAY_BUFFER, 0);
      }
  
      public void setVertexAttribPointer(int dataOffset, int attributeLocation, int componentCount, int stride) {
          glBindBuffer(GL_ARRAY_BUFFER, mBufferId);
          glVertexAttribPointer(attributeLocation, componentCount, GL_FLOAT, false, stride, dataOffset);
          glEnableVertexAttribArray(attributeLocation);
          glBindBuffer(GL_ARRAY_BUFFER, 0);
      }
  }
  </code></pre>