View Full Version : gltranslatef problem

12-12-2005, 07:36 AM
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!!

12-12-2005, 07:41 AM
That's one way, but could accumulate errors.
The nicer way is to do
// Assuming glMatrixMode(GL_MODELVIEW) is active
glTranslatef(0.0f, 10.0f, 0.0f);

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().

12-12-2005, 06:50 PM
thx! im doing that now but it still keep on going up doesnt go back to 0 i wonder what culd be wrong???

12-12-2005, 06:55 PM
nvm im with stupid :) thx