OpenGL already contains this functionality. You want glPushAttrib(GL_ALL_ATTRIB_BITS);
and glPopAttrib();
. See http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html for more.
Rune
2008-12-14 17:39:26