hi im moving a cube from y=0 to y=10 usualy when the cube is on y=10 i want it to go back to 0 but if i do gltranslatef(0,0,0) it doesnt go back to 0 it just doesnt do anithing i dunno why
if i do sumthing like gltranslatef(0,-10,0) then it goes back to 0 but this is lame!!
That’s one way, but could accumulate errors.
The nicer way is to do
// Assuming glMatrixMode(GL_MODELVIEW) is active
glPushMatrix();
glTranslatef(0.0f, 10.0f, 0.0f);
DrawCube();
glPopMatrix();
No chance to accumulate errors here and the push and pop operations should be quicker than matrix manipulations.
If you have a deep hierarchy you need to check the maximum matrix stack size of the different matrix modes with glGetInteger().