Sign in to follow this  

quaternions for rotate

This topic is 4053 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

This topic is 4053 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this