PDA

View Full Version : need help with this rotation problem



spooky
04-15-2004, 09:41 PM
Hi i am having real trouble trying to solve this problem

I have a model loaded into a opengl window

I want the user to be able to rotate the model around the current upvector by draging the mouse left/right on the window, and around the current right vector, draging the mouse updown.

Imagine this, default upVector=(0,1,0). If you rotate this 90deg ccw on the yz plane your new up vector will be (0,0,-1). Once the model is in this position any left/right drag of the mouse to uspdate the rotation around the (0,1,0) axis will make it rotate around the old axis, which is now pointing in a wrong direction. At his point when i move the mouse left and right the model should rotate around (0,0,-1) which is the -z axis, not around the old y axis.

How can i do this, using the glrotate command, specificly how do i find the current up vector, after the model has been rotated from the default, i cant use the default upvector, becasue that now points in a ddifferent location

any help appreciated

thanks