View Full Version : several glrotatef calls in one

12-06-2003, 03:59 AM
can i preform the following two calls in one single?

glRotatef(90, 0, 0, -1);
glRotatef(90, 1, 0, 0);

i tried using:
glRotatef(90, 1, 0, -1);

but the result was more like a random rotation..

12-06-2003, 05:21 AM
Hi !

No you cant' look at it like this, the first example will first rotate around the Z axis and then around the X axis.

The second example will rotate around an axis somewhere between the X and Z axis so you will not do the same rotation.

The last three arguments specify the axis to rotate around.


12-06-2003, 05:59 AM
What you can do is compose a transformation matrix which will do the same. Ie generate a matrix for each rotation, then multiply the two, and then save the resulting matrix.

The anytime you can multiply this matrix times
the modelview.

Make sure that your matrix column order. Ie
in C matrices are usually composed row order.
Just do the transpose of your composite matrix and pass that transpose to glMultMatrix.