PDA

View Full Version : Rotation/Translation problem driving me nuts



DaBrain
06-21-2001, 09:01 AM
Ok I have tried to fix this numerous ways but I can't seem to get it to work. Here is my ordeal:

I am working on a Silicon Graphics box and I am working on code that allows you to pan/zoom/rotate a 3d object. My zooming algorithm works just fine, but I have run into a problem with the pan/rotate.

Each of the three mouse buttons do different things. Left button is Pan, middle is zoom, and right is rotate. Currently I call glRotatef and then glTranslatef. My rotation works fine because the object rotates about its center.
The problem is that when I rotate the object 180 degrees horizontally or vertically then the panning is off 180 in the respective direction (i.e. panning down makes the object move up, left moves the object right).
I tried switching the order of the calls and making Translate first and then Rotate and that fixes the panning problem, but then the object rotates about the world origin which I dont want. It needs to rotate about its center.

Help!
Email me at crasco@mail.arc.nasa.gov for clarification.

Turbo_Pascal
06-21-2001, 09:16 AM
Originally posted by DaBrain:
Ok I have tried to fix this numerous ways but I can't seem to get it to work. Here is my ordeal:

Currently I call glRotatef and then glTranslatef. My rotation works fine because the object rotates about its center.
The problem is that when I rotate the object 180 degrees horizontally or vertically then the panning is off 180 in the respective direction (i.e. panning down makes the object move up, left moves the object right).
I tried switching the order of the calls and making Translate first and then Rotate and that fixes the panning problem, but then the object rotates about the world origin which I dont want. It needs to rotate about its center.
clarification.


The solution is ease, for pan, DO NOT MOVE THE OBJECT, move the camera instead.

Turbo Pascal.