a problem about ROTATION, help plz.

I want image continuesly rotation controled by hand.
For example if i press left key then image rotate horizontally,
I want to control the image in 6 direction(left ,right ,up ,down ,outside and inside according to the screen).
At first I use
But it can’t rotate according to screen(in another word , rotate in a fixed coordinate), later rotate axis was affected by the former rotation.if have a example code will be the best.
thanks a lot, help me please.
my e-mail: arjie_yes@hotmail.com

use quaternion

thank ctoa for replying. But I don’t know quaternion.
Could you please explain it?or give me a sample code.

I have use glMultMatrixf(float &a);but i can only let image rotate according it’s own axis; but it can’t rotate according to the fixed axis(Such as whenever I press left key image will rotate to screen left).My matrix calculation was wrong.

[This message has been edited by arjie (edited 11-11-2002).]

To do what I think you want to do you will get away by using glLoadIdentity() before drawing and rotating your model.

The problem you are having is called ‘gimbal lock’. You need to use a quaternion to represent the rotation, you can turn a quaternion into a rotation matrix and then use glMultMatrix().
There is a good FAQ on quaternions at -http://www.cs.ualberta.ca/~andreas/math/matrfaq_latest.html.

Hope this helps,

Steve O’Connor

Cool I was wondering what was wrong with my rotations now I know, Gimbal Locks.

thanks for steveo’s helping.
I solve my problem.
thanks again.

If you want to know about quaternions there is a good pdf on David Eberly’s site Magic Software . Look in the Documentation section for the article on ‘Quaternion Algebra and Calculus’. One stop shop for quaternion knowledge.