I'm not sure if your question is about when you can call glGetError if inside glBegin/End or whether it's a more general question about glGetError usage in general. So I'll answer both.
What you can do between glBegin and glEnd is very limited. This is on purpose, as you put the GL in a very specific mode - in the middle of a Draw. As such, anything that does not relate directly to per-vertex attributes is simply invalid. Even a glGetError is invalid in that context.Try and think of glBegin+all the GL calls in between+glEnd as a single Draw call to the GL, that helps get closer to what the GL really does anyways.
Now, you should never really have a GL error triggered while inside the Begin/End pair if you stick to the simple rule to only call attribute methods (glNormal, glTexCoord, glColor, glSecondaryColor, glIndex, glMultiTexCoord, glVertexAttrib, glVertex and a couple others). Anything else will trigger an error. (err... well, glMaterial is a bit of an exception. It works, but its usage has been discouraged)
If your question is when you can call glGetError when the error was triggered inside a Begin/End pair, ChrisF answered in a comment: after the glEnd call.
Now, in a broader sense, use glGetError only as a debugging tool. My personal bias is twofold:
- check glGetError once per frame to be sure there is no error
- wrap most GL calls with a macro that can check the GL error code, and only turn it on when the per-frame check fails.
Of course, since the attribute methods can be called outside a Begin/End pair, it's a bit tricky to get them right. But in practice, those methods never fail anyways, so I don't bother to macro-check them.
A tidbit of trivia: the GL API was originally designed so that the client implementation could actually not know whether there was an error at the call site. E.g. if the GL was actually implemented in a remote machine (like in the SGI days), a ca
answered 2010-01-01T14:10:50.713