Rotation functions needed

there is only one GLFunction to rotate objects. I would like to see a function added to rotate (Z-angle, Y-Angle, X-Angle) to rotate objects around axises

But… isn’t that what the glRotate function already does? You specify an angle of rotation and an axis of rotation. What other kind of rotation is there ?

There is no single opengl function to rotate objects, but there’s a function (glRotate) to compute a rotation matrix and multiply it onto the matrix stack. It not that hard to write your own function to compute the rotation matrix if you don’t like opengl’s.

-Lev

Originally posted by Olive:
What other kind of rotation is there ?

3ds max uses 2 types Quaternion & EulerAngles
EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis. The axises are world axises not local.
Quaternion I dont understand

Originally posted by Lev:
not that hard to write your own function to compute the rotation matrix.
-Lev

I dont have a clue where to start, I am self taught so there are gaps in my mathmatical ability, can you help me write a conversion from EulerAngles to what OpenGL uses.

“EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis.”

Then do that. glRotate about the Z axis, then glRotate about the X axis, then glRotate about the Y axis.

Originally posted by Korval:
[b]“EulerAngles is …”

Then do that… [/b]

doing that in Open GL is not posible because it replaces 1 rotation with the next,
Euler rotates the origonal model on the Z axis to create a copy, that copy is then rotated on the X axis to create A second Copy The Second Copy is rotated on the Y axis to create the model to be rendered,
of coarse the code only keeps the final result and the original.

it has to be read bottom up, 'cause thats the order of operations, but… surely this is doing EXACTLY like you describe?
<shrugs>

glLoadIdentity();

/* ... is rotated on the Y axis to create the model to be rendered, */

glRotate(yaxis, 0.0, 1.0, 0.0);
glPushMatrix();          /* copy rotation */

/* ... that copy is then rotated on the X axis to create A second Copy The Second Copy */

glRotate(xaxis, 1.0, 0.0, 0.0);
glPushMatrix();          /* copy rotation */

/* Euler rotates the origonal model on the Z axis to create a copy */
glRotate(zang, 0.0, 0.0, 1.0);
glPushMatrix();          /* copy rotation */

Originally posted by King Fuzzy:
3ds max uses 2 types Quaternion & EulerAngles
EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis. The axises are world axises not local.
Quaternion I dont understand

Ok. I should’ve made myself clearer. Quaternions are another mean for mathematically representing a rotation. You can see them like complex numbers extended in 3D. And just like complex numbers can represent rotations in 2D, quaternions can represent rotations in 3D.

Euler angles is just a combination of three rotations.

Another way to represent a rotation is with a 3x3 matrix.

But however you represent a rotation, it still “visually” ends up to a rotation of a certain angle around a 3D axis. If you can specify those two parameters you can code any rotation you want.

Some representations offer benefits that others don’t in terms of interpolation, readability (quaternions and matrices are unreadable), compacity, available mathematical operations, etc…

Sorry for the long blurb. Over and out.

Thankyou John, I hadnt come across the glPushMatrix Command yet
I have only been programing OpenGL fo about 5 days now

Olive, I dont know how to calculate the axis and angle to rotate an object to where I want it, I have lerned most of my mathmatical ability by my self, so there are major gaps in my ability.
I also used to program on C64 and Amiga so there are also conflects in the terminoligy I have lerned (Microsoft causes some with itself) even opengl causes confusion with some of the terms it uses, like ‘Name’, refering to a number instead of using the term ‘ID’

This forum is called ‘Sugestions for next Release’, So do you think more Rotation functions would be a good addition for the next release?

No, I don’t think so. Being able to specify a matrix or an axis/angle is enough. I think where were previous discussions about whether or not to give a quaternion interface to the glRotate functions a while ago, so you can search through the archive of this forum.

Maybe glRotatefv and glTranslatefv functions would be nice…?

[This message has been edited by Olive (edited 08-24-2001).]

Originally posted by Olive:
[b]No, Being able to specify a matrix or an axis/angle is enough. Maybe glRotatefv and glTranslatefv functions would be nice…?

[This message has been edited by Olive (edited 08-24-2001).][/b]

I dont understand ‘matrixes’, do you know where I can get info about how they work ?, I cant afford to bye much so on the net would be better

Here’s a good link: http://www.cs.ualberta.ca/~andreas/math/matrfaq_latest.html

there you’ll find some info about matrices, and a source how to convert euler angles to a matrix, … Read this stuff carefully

-Lev

Originally posted by Lev:
[b]Here’s a good link: …

-Lev[/b]

Thankyou for the help