I want to acheive translations/rotations as shown in following video -
http://www.youtube.com/watch?v=92h0xuV4Yrg
I know for independant translation and rotation, typical method is - first rotate the object and then translate.
As shown here:
PushMatrix();
LoadIdentity();
Translate(posx,posy,posz); // Second, move the object to its final destination
Rotate(); // First, apply rotations (which rotate around object-origin
Draw();
PopMatrix();
But my requirment is to rotate the object around world-coordinate and move it using mouse.
As seen in the video, the rotation is done around the world-origin not around object-origin.That means the logic should be opposite to above (first translate and then do the rotation)
PushMatrix();
LoadIdentity();
Rotate(); // Second, apply rotations (which rotate around world-origin)
Translate(posx,posy,posz); // First, move the object to its final destination
Draw();
PopMatrix();
But the,final translation in the video is done relative to final position after the rotations.(which is not same as the posx,posy,posz values I manipulate using mouse ).
How to achive this kind of translations