q0987
q0987

Reputation: 35982

Which OpenGL attribute should be pushed in order to restore later?

glPushAttrib(GL_POINT_BIT | GL_CURRENT_BIT); // LINE ONE
    glColor3f( 1.0f, 0.0f, 0.0f );
    glPushMatrix();
        glTranslatef(50.0f, 100.0f, 200.0f);
        // GLUquadric* pQuadric;  // quadric for sphere display
        gluSphere(pQuadric, 2.0, 10, 10);
    glPopMatrix();
glPopAttrib();

I need to make sure that after the drawing the attribute stack is restored. What should I do in the line one? It seems that 'GL_POINT_BIT' has no usage here. Is that correct?

http://www.opengl.org/sdk/docs/man/xhtml/glPushAttrib.xml

GL_POINT_BIT GL_POINT_SMOOTH flag/Point size

Upvotes: 1

Views: 675

Answers (1)

Kromster
Kromster

Reputation: 7397

Your code does not contains any line\point state changes.. Hence there's no need to push anything, except for transformation matrix and maybe current color (glPushAttrib(GL_CURRENT_BIT)).

You can read more about glPushAttrib on the following page from OpenGL docs: http://www.opengl.org/sdk/docs/man/xhtml/glPushAttrib.xml

Upvotes: 3

Related Questions