Advertisement Jump to content


This topic is now archived and is closed to further replies.


OpenGL re opengl rotations

This topic is 5391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites
If you want to know the current up vector,just do this:

vector up;
float m[16];



I hope this help.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!