Sunday, June 12, 2005

glPushAttrib, glPopAttrib

glPushAttrib() cannot be called inside a the glBegin() and glEnd() pair.

This is a sample
// Draw the lines
glPushMatrix();
glPushAttrib(GL_CURRENT_BIT ); // Push the current attributes bit
glBegin(GL_LINES);
glColor3f(.5,.5,.5); // Grey color
glVertex3f(-nRange, 0, 0); // x-axis
glVertex3f(nRange, 0, 0);
glVertex3f(0, -nRange, 0); // y-axis
glVertex3f(0, nRange, 0);
glEnd();
glPopAttrib();
glPopMatrix();

0 Comments:

Post a Comment

<< Home