PDA

View Full Version : glGetError() between glBegin() / glEnd() ...



Heriberto Delgado
03-03-2007, 08:21 AM
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???

k_szczech
03-03-2007, 10:03 AM
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.

Komat
03-03-2007, 10:32 AM
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.

Heriberto Delgado
03-03-2007, 10:42 AM
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 :D

Thanks, people!

k_szczech
03-03-2007, 03:22 PM
0 it is then. Thanks for correcting me.