View Full Version : does glScalef...

06-28-2004, 02:38 PM
does it change rotations and translations, because in the arm example in Opengl Programming Guide. They pushed the matrix, scaled a cube, drew the cube then popped the matrix. I took out the push and pop and then whatever else I drew were on spinnning along other axies(sp?) I took out the scale and the pop and the cubes rotate as expected.

06-28-2004, 11:24 PM
of course. glScale scales a matrix by some value. when you apply a scale by 1/2 and afterwards a simple translation, the translation and the model is scaled by 1/2. when swapping the operations, you will get a scaled model, but not a scaled transformation.

as you can see (through push and pop) the opengl matricies can be saved on a stack. push copies the current matrix to the stack and pop copies the topmost stack matrix back to the current one. every modification you do between push and pop will be lost. so, when you removed the pop, everything will be scaled or rotated or whatever as long as you dont pop. popping the matrix returns it into the state that it had before push.