Jump to content
• Advertisement

# 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

##### Share on other sites
Advertisement

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
Rutin
24
2. 2
3. 3
4. 4
JoeJ
18
5. 5
• Advertisement

• 14
• 14
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002142
×

## 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!