title: glColor, glMatrixMode mysteriously giving "Invalid operation" errors
body: <p>Recently my game-engine-in-progress has started throwing OpenGL errors in places that they shouldn't be possible. After rendering a few frames, suddenly I start getting errors from glColor:</p>
  
  <pre><code>print(gl.GetError()) --&gt; nil
  gl.Color(1, 1, 1, 1)
  print(gl.GetError()) --&gt; INVALID_OPERATION
  </code></pre>
  
  <p>If I don't call glColor here, I later get an invalid operation error from glMatrixMode.</p>
  
  <p>According to the GL manual, glColor should never raise an error, and glMatrixMode only if it's between glBegin and glEnd, which I've checked is not the case. Are there any other reasons these functions can raise an error, that I'm not aware of? Maybe related to render-to-texture/renderbuffer extensions? I've been debugging like mad and can't find anything that should cause such failures. The whole program is a bit too large and complex to post here. It's using luagl, which is just a thin wrapper around the OpenGL API, and SDL. The reported version is: 2.1 Mesa 7.10.2</p>