View Full Version : multiple glRotate functions

stevebass

04-20-2003, 09:45 PM

Given the following code...

glRotatef(theta, 0.0, 0.0, 1.0);

glRotatef(theta, 1.0, 0.0, 0.0);

Why don't these functions emulate the behavior of...

glRotatef(theta, 1.0, 0.0, 1.0);

and is there a way to emulate the latter line of code using two glRotatef functions?

Thanks, Steve

stevebass

04-20-2003, 09:48 PM

One other thing...

why is

glRotatef(theta, 0.0, 0.0, 1.0);

glRotatef(theta, 1.0, 0.0, 0.0);

different from

glRotatef(theta, 1.0, 0.0, 0.0);

glRotatef(theta, 0.0, 0.0, 1.0);

glRotatef(theta, 0.0, 0.0, 1.0);

glRotatef(theta, 1.0, 0.0, 0.0);

is not the same thig as

glRotatef(theta, 1.0, 0.0, 1.0);

The first rotates first theta degrees about the axis (0,0,1) and then theta degrees about the axis (1,0,0). The second rotates only once, theta degrees about the axis (1,0,1). I think it's pretty hard to explain in words why it's different, so I suggest you write an application that performes these two rotations on two cubes next to each other and see for yourself.

It is possible to emulate two rotations (if not all possible combinations, at least most of them) with a single rotation. Search the web for euler angles to axis angle conversions and see what you can find. I don't know of anything myself, sorry.

And matrix multiplications are not comutative, meaning order of multiplication is important. A*B is not the same as B*A.

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.