Rotate an object indipendently from previous rotations

How can we rotate an object indipendently from previous rotations? I.e. how can we rotate a sphere? I tried:

glRotatef(anglex,1.0f,0.0f,0.0f);
glRotatef(angley,0.0f,1.0f,0.0f);

but It didn’t work.

I don’t know what you exactly wxant to do but if you try :

glPushMatrix();
glRotate(x)
your sphere
glPopMatrix();
glRotate(y)
your sphere