View Full Version : gltranslatef problem
doodlemunch
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!!
Relic
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
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().
doodlemunch
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???
doodlemunch
12-12-2005, 06:55 PM
nvm im with stupid :) thx
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.