View Full Version : several glrotatef calls in one

Jernej

12-06-2003, 04: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..

mikael_aronsson

12-06-2003, 06: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.

Mikael

maximian

12-06-2003, 06: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.

...

glMatrixMode(GL_MODELVIEW);

glMultMatrix(myMatrix);

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.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.