Anyway, this is what I think I want to be doing:
1. Find rotation about vertical(x-axis) and horizontal(about y-axis) based on mouse movement.
2. Combine these using quaternion multiplication to get a quaternion that represents the change in rotation.
3. Multiply that quaternion by the "view" quaternion from the last frame and its conjugate.
4. Feed Quaternion to OpenGL.
And here is my function.
//passive mouse motion
void passiveMotion(int mx,int my)
{
cout << qview.w << ":";
cout << qview.x << ":";
cout << qview.y << ":";
cout << qview.z << ":::";
cout << length(qview) << "\n";
phi = (mx - mxo)/msensitivity;
theta = (my - myo)/msensitivity;
mxo = mx;
myo = my;
quaternion qhorz;
quaternion qvert;
quaternion qmove;
quaternion qtemp;
qhorz.w = cos(theta/2);
qhorz.x = 0*sin(theta/2);
qhorz.y = 1*sin(theta/2);
qhorz.z = 0*sin(theta/2);
qvert.w = cos(phi/2);
qvert.x = 1*sin(phi/2);
qvert.y = 0*sin(phi/2);
qvert.z = 0*sin(phi/2);
qtemp = qview;
qmove = mult(mult(qvert, qhorz),conjugate(qvert));
qview = mult(mult(qtemp, qmove), conjugate(qtemp));
qview = normalize(qview);
glutPostRedisplay();
}
...And how I tell OpenGL to rotate:
glRotatef(qview.w, qview.x, qview.y, qview.z);
Thanks in advance for your help.
-Tobey












