## Possible to express two glRotate in one glRotate?

### Possible to express two glRotate in one glRotate?

I wonder if it is possible to express two glRotate in one glRotate?

I am working on a program that the curretn rotation angle and axis are
displayed as a user rotate an object in any direction.
I am using glRotatef( angle, x, y, z) to rotate an object.
But if an object is rotated more than once in any random direction,
how can I calculate the angle and axis values?

For example, a user rotate an object 90 deg. about x axis and then
rotate 90 deg. about z. axis, is it possible to express these two
rotations in a single glRotate function?

Byungsung Cho

### Possible to express two glRotate in one glRotate?

I think you need to implement quaternions.

A quaternion expresses a rotation, and subsequent rotations
are handled as quaternions combinations. Then from the resulting
quaternion, you get the resulting rotation (axis + angle), that
you give to glRotate...

> I wonder if it is possible to express two glRotate in one glRotate?

> I am working on a program that the curretn rotation angle and axis are
> displayed as a user rotate an object in any direction.
> I am using glRotatef( angle, x, y, z) to rotate an object.
> But if an object is rotated more than once in any random direction,
> how can I calculate the angle and axis values?

> For example, a user rotate an object 90 deg. about x axis and then
> rotate 90 deg. about z. axis, is it possible to express these two
> rotations in a single glRotate function?

> Thanks in advance,

> Byungsung Cho

Hi,
is there a way to make 3 rotations with 1 glRotate ?
Each rotation is about one axis (x, y, z).
Example:
glRotatef(degree1, 1.0, 0.0, 0.0)
glRotatef(degree2, 0.0, 1.0, 0.0)
glRotatef(degree3, 0.0, 0.0, 1.0)

I need to obtain the effect of these 3 instructions
with just one glRotate. Is it possible ?
Thanks.

3. glRotate

12. glRotate