Jump to content
  • Advertisement
Sign in to follow this  

quaternions for rotate

This topic is 4272 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'm having problems implementing quaternions for the rotation of a trackball. i'll admit i'm a pretty horibble programmer, but i am getting frustrated. i commented the glRotatef part which is what i'm tryin to not use and use quaternions instead. the result is that the rotation is going super fast, but it appears that it is working. thanks for any help. //callback functions void callback_display(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); /* view transform */ if (trackballMove) { length = sqrt(axis[0]*axis[0] + axis[1]*axis[1] + axis[2]*axis[2]); axis[0] = axis[0]/length; axis[1] = axis[1]/length; axis[2] = axis[2]/length; xz[0] = cos (angle/2); xz[1] = axis[0] * sin (angle/2); xz[2] = axis[1] * sin (angle/2); xz[3] = axis[2] * sin (angle/2); cm(xz); glMultMatrixf(q2m); // glRotatef(angle, axis[0], axis[1], axis[2]); } glmDraw(model, GLM_SMOOTH); glutSwapBuffers(); } [Edited by - satjo7 on November 7, 2006 10:37:05 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!