I draw some object and would like to do “pan”. I have some trouble to reach what I want. Here is what I want: when I move my mouse, I hope the object I draw can follow my mouse point.
I tried 2 ways:
Way 1
- LoadIdentity; 2) Rotate; 3) Translate; 4) Draw Object
The object move along the rotated coordinate system instead of the original coordinate system;
Way 2)
- LoadIdentity; 2) Translate; 3) Rotate; 4) Draw Object
The object moves fine. However, when I try to rotate the object, I want to rotate it around the original coordinate system, not the local one, or the translated one.
How can I solve my problem? Thank you very much.