Please help me with rotation of an object with mouse input :
I have a ‘Intermediate’ quaternion which goes from ‘Initial’ quat to ‘Final’ quat through SLERPing.
Intermediate = QuaternionSLERP(
InitialQuaternion ,
FinalQuaternion ,
ALPHA); // goes from 0.0 to 1.0
// ObjectAxis is a ‘Vector’,
// ObjectAngle is a ‘float’
QuaternionToAxisAngle(
Intermediate,
&ObjectAxis,
&ObjectAngle);
Then, somewhere in DrawGL() loop :
…
…
// RTOD = (180.0/PI)
glPushMatrix();
glRotatef(
ObjectAngle*RTOD,
ObjectAxis.x,
ObjectAxis.y,
ObjectAxis.z);
// draw a sphere
auxWireSphere(40.0f);
glPopMatrix();
…
…
ALPHA+=1.0f;
If(ALPHA>=1.0f)
ALPHA=0.0f;
…
Can someone please let me know as to how I could apply the same ‘SLERP’ technique for rotating the object via MOUSE input in Win32 ?
Thanks.