Does glLoadIdentity for attributes exist in OpenGL
glLoadIdentity is convenient to come back to th开发者_如何学JAVAe original matrix. Does something similar exist for the attributes of OpenGL, like loadIdentityAttribs(GL_ALL_ATTRIB_BITS)
which would go with the family of glPushAttrib(GL_ALL_ATTRIB_BITS)
and glPopAttrib
?
Not really - the closest equivalent is to immediately push the default state, making sure that that default is available on the stack. In that case, you can always pop back to the default. Admittedly, the default is then at the bottom of the stack but it is there.
The attributes do have documented defaults but there really isn't a convenient way to say "everybody reset to start."
My suggestion is to select the attributes that you really care about for your application and to write the method that sets those back to your defaults.
精彩评论