glLoadIdentity says
GL_INVALID_OPERATION
is generated ifglLoadIdentity
is executed between the execution ofglBegin<
Normally you should call glGetError
after every other gl...
call as one of the effects of the call is to clear the error from the stack (from the MSDN):
When an error occurs, the error flag is set to the appropriate error code value. No other errors are recorded until glGetError is called, the error code is returned, and the flag is reset to GL_NO_ERROR.
However, if you have calls wrapped in glBegin
and glEnd
call glError
after the glEnd
. This should return you the correct error code (if there was one) and clear the error stack.