title: glDraw* returning GL_INVALID_ENUM
body: <p>I'm trying to render some objects in OpenGL, but even though I call <code>glDrawElements</code> with the right mode, it still gives me a <code>GL_INVALID_ENUM</code>. This is the call log, as recorded by AMD's CodeXL, from setup to rendering:</p>
  
  <pre><code>glBindVertexArray(1) 
  
  ... creating shaders/programs and getting uniform locations ...
  
  # the vertex buffer
  glGenBuffers(1, 0x008A945C) 
  glBindBuffer(GL_ARRAY_BUFFER, 1) 
  glBufferData(GL_ARRAY_BUFFER, 96, 0x008A94A0, GL_STATIC_DRAW) 
  
  # the element index buffer
  glGenBuffers(1, 0x008A9460) 
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 2) 
  glBufferData(GL_ELEMENT_ARRAY_BUFFER, 96, 0x008A9508, GL_STATIC_DRAW) 
  
  glClearColor(0.12, 0.63999999, 0.55000001, 1) 
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) 
  
  
  glEnableVertexAttribArray(0) 
  glUseProgram(1)
  
  glUniformMatrix4fv(0, 1, FALSE, ... MVP Matrix ...)
  glBindBuffer(GL_ARRAY_BUFFER, 1) 
  glVertexAttribPointer(0, 3, GL_FLOAT, FALSE, 0, 0x00000000) 
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 2) 
  
  
  glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, 0x00000000) # GL_INVALID_ENUM here &lt;----
  
  
  glUseProgram(0)
  glDisableVertexAttribArray(0) 
  wglSwapBuffers(0x09011214) 
  </code></pre>
  
  <p>I've already tried swapping <code>glDrawElements</code> by <code>glDrawArrays(GL_QUADS, 0, 4)</code> (with the right parameters) and it still gives me the same error. What could be causing this? CodeXL seems pretty sure the error is raised exactly at the draw call, not before.</p>