PDA

View Full Version : what's the impact of glBeing(),glEnd()



zhengle
11-20-2008, 08:12 PM
I want to draw some text and a background board under the text. So, I draw the background board first, and then DrawText:
glBegin(GL_QUADS);
glVertex3f(...);
...
glEnd();
DrawText();

Now the text disappeared. When I put the glPushAttrib/glPopAttrib pair, the text will been seen:

glPushAttrib(GL_COLOR_BUFFER_BIT)
glBegin(GL_QUADS);
glVertex3f(...);
...
glEnd();
glPopAttrib();
DrawText();

I can't see any other state switching call in the gDDebuger. But the result seems to tell us that the glBegin(GL_QUADS)/glEnd() has changed something. what's that?

ZbuffeR
11-21-2008, 02:49 AM
No glColor between begin and end ?

zhengle
11-22-2008, 07:59 PM
no glColor, neither glNormal, nor glTexCoord, just ONLY glVertex between the glBegin and glEnd.

Is that legit? I am curious it should be the bug of the openGl implementation(win32_XP/ATI Radeon HD 2400 pro) or I have some misunderstand about the openGL.

ZbuffeR
11-23-2008, 04:48 AM
Try putting glGetError() around, check none happens.
Try testing it on an nvidia card for example, if the behavior is the same, it is probably not a bug in the implementation but in your code.