glGetError() bug?!?

Post: #1
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
Quote this message in a reply
Posts: 869
Joined: 2003.01
Post: #2
afaik, there is no point to calling glError inside glBegin, but use gluErrorString(glGetError()) to find a better description of the error, anyway.
Quote this message in a reply
Post: #3
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().
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #4
Quote:[font=monaco,courier] 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
Quote this message in a reply
Post: #5
Uh... Oh... well, so it was me that was doing a BAD THING... Wink
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... Wink
Quote this message in a reply
Post Reply