glGetError() between glBegin() / glEnd() ...

Ok. Let’s settle this.

Of course, calling glGetError() between glBegin() / glEnd() is an error; in fact, a GL_INVALID_OPERATION_ERROR. I can imagine that any queries to GL state must go through some kind of complex software/hardware structures before getting any results; however, I also imagine that any non-permitted operations shall not go through these structures.

Either way, glGetError() must still return something. Does glGetError() jump over all security measures to return the last error, even if it is it’s own error (GL_INVALID_OPERATON_ERROR), or it just returns the aforementioned value without asking for anything else? Or, (worse yet), does it return 0 (since it can’t check for error conditions anymore)???

In other words, what must glGetError() return when issued between glBegin() / glEnd() calls???

Look at GetError specs - it states that offending command is ignored.
That means GetError between Begin/End is ignored, and first GetError after End will return INVALID_OPERATION.

Since the command is ignored, value it returns is undefined.

Originally posted by k_szczech:

Since the command is ignored, value it returns is undefined.

If command that generated error returns value, the returned value will be zero.

Hm… look what I found at 2.1 spec:

Table 2.3 summarizes GL errors. Currently, when an error flag is set, results of
GL operation are undefined only if OUT OF MEMORY has occurred. In other cases,
the command generating the error is ignored so that it has no effect on GL state or
framebuffer contents. If the generating command returns a value, it returns zero.

Hm… seems like glGetError() should return 0 then :smiley:

Thanks, people!

0 it is then. Thanks for correcting me.