PDA

View Full Version : glGetError() bug?!?


oxenos
2003.04.16, 12:33 PM
Hi all!

I'm experiencing a strange behaviour of glGetError(): if I call it just after ANY glBegin() statement I get a 0x0502 error code. It doesn't matter in which conditions, how I create the GL context or any other GL state (matrixes, materials, etc), I get the error ONLY after glBegin(). The surprising thing is that it happens with both my iMac and iBook, both with MacOS classic (9.1 and 9.2) and MacOS X (10.2.1). Even more surprising, if I chack for the error AFTER the glEnd() statement no error is reported at all, I get an error ONLY if I check it after glBegin() - and it happens on SGI glut demos too, so I think it's not my code's fault.

Is it a bug in Apple's OpenGL implementation? Is it normal behaviour? Does it happen on your hardware too?

thanx in advance to whoever will be so kind to answer to me for his/her time.

--

The Alien

DoG
2003.04.16, 03:56 PM
afaik, there is no point to calling glError inside glBegin, but use gluErrorString(glGetError()) to find a better description of the error, anyway.

blb
2003.04.16, 05:00 PM
There are a specific set of commands which can be run while inside glBegin()...glEnd() (see the manpage for glBegin for the list). 0x0502 is GL_INVALID_OPERATION (according to gl.h), and if you look at the end of the manpage for glGetError() you'll see this is what happens when it is called inside glBegin()...glEnd().

OneSadCookie
2003.04.16, 05:44 PM
GL_INVALID_OPERATION is generated if glGetError is exe-
cuted between the execution of glBegin and the correspond-
ing execution of glEnd. In this case glGetError returns
0.

oxenos
2003.04.18, 07:25 AM
Uh... Oh... well, so it was me that was doing a BAD THING... ;)
Ok, thank you very much for your kind answers! BTW I know there's no point in calling glGetError() inside glBegin()/glEnd(), but I was using the gl profiler under MacOS X and with breakpoint-on-error turned on, and just after every glBegin program stopped (but, as you pointed out, this is the correct behaviour of GL...) - sorry for my stupid question, next time I'll read the manuals... ;)