resetting openGL state

I am using openGL instructions in vega prime for drawing.

I am using the following code.

//storing the current attribute values


//restoring old attribute values

But the graphics are not resetting to its previous values(eg. sky color is changed when drawing). But after completion of whole openGL drawing, the vega prime scene is resetting to its previous value(even with out resetting the old attribute values). But I want the remain scene in its original state while drawing. How can I do that? (i.e. the background scene should not change while drawing with openGL functions).

Sounds more like a driver bug when ALL_ATTRIB_BITS is not restoring the color which is pushed with CURRENT_BITS.
What OpenGL implementation are you running? (graphics board, driver version)

If all you change is glColor and glPolygonMode, it would be enough to do glPushAttrib(GL_CURRENT_BIT | GL_POLYGON_BIT);

If that doesn’t help with the color, you could also try
float fColor[4];
glGetFloatv(GL_CURRENT_COLOR, fColor);
outside the PushAttrib/PopAttrib part.

I’d rather not push/pop any vertex attribute related data. Its better (and most probably cheaper) to just do an appopriate glColor() call right before you start drawing something. Relying on a certain color to be “default state” is for sure a bad practice.