PDA

View Full Version : how to use glTranslate to do "pan"?



gardener
09-01-2009, 03:17 PM
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
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)
1) 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.

rakesh_thp
09-13-2009, 11:44 PM
Hi gardener..

Your problem falls in Code beginners category.. Not here..

Anyways, actual panning is different then what you want to achieve..

You want the object to follow the mouse as u move the mouse.. This is not panning.. i guess i'm right with my knowledge.. Any senior ppl do correct me if i am wrong.. Shift this topic to code beginners section.. You'll find lot of replies..

good luck..