PDA

View Full Version : Rotation of objectwith Mouse



hariparisodhana
05-04-2004, 12:51 AM
hi,

can any body out there help me in rotating
a 3D object in space using mouse?
please reply.

05-04-2004, 03:43 AM
u can rotate in two ways move the camera or move the object apply modelview Matrix transformations
in both the cases.

malancha
05-04-2004, 04:18 AM
What I do is keep four variables: oldMouseX, oldMouseY, currMouseX, currMouseY.
Depending on the amount by which the mouse coordinates change upon dragging, I make call glRotate with a varying angle and then update the current mouse coordinates to the old mouse coordinates.

There might be easier/faster ways to accomplish it, but this is the only one I happen to know.