Sign in to follow this  
ManaStone

Does glRotatef() use a quaternion to implement the rotation?

Recommended Posts

ManaStone    148
I was just curious if it does this. From reading Jim Adam’s book, I got the impressions that the main differences between a regular rotation and a quaternion rotation is that the regular rotations are based along the x, y, or z axis and can have problems with concatenation, whereas the quaternion rotations can rotate along a vector. Because glRotatef() gives you a vector to rotate around, I thought that it might be implemented using a quaternion.

Share this post


Link to post
Share on other sites
chowe6685    349
very doubtful

opengl works with matrices. Somewhere I'm sure you can find the formula for a rotation matrix around an arbitrary axis (google for example). Though I don't know for sure I assume glRotate just builds an appropriate rotation matrix and then calls glMultMatrix with that matrix. Using a quaternion would add an extra unnecessary conversion.

Share this post


Link to post
Share on other sites
snk_kid    1312
Quote:
Original post by ManaStone
x, y, or z axis and can have problems with concatenation,


Are you sure your not talking about Euler angles there not the same, rotation matrices don't suffer from gimbal lock.

Quote:
Original post by ManaStone
Because glRotatef() gives you a vector to rotate around, I thought that it might be implemented using a quaternion.


Opengl work with 4-by-4 matrices, it puts the angle into a rotatation matrix and then multiplies it with the current model-view matrix.

you might wont to read this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this