PDA

View Full Version : Translates and Rotations on Mac OS X vs. PC



04-30-2003, 06:02 AM
Hello all.
(I have posted this message in the mac forum as well. But i thought maby some one here know's a possible answer as well.)

I am coding a OpenGL based 3d Engine for the mac in my spare time. I have run into some problem with translations and Rotations.
I have for example some variables for the positions of a object let's say objposx objposy and objposz. To always move in the ahead direction i use following forumla:

objposx += sin(direction * 3.14 / 180) * velocity;
objposz += cos(direction * 3.14 / 180) * velocity;

after that i tranlate:
glTranslatef(objposx, objposy, objposz)
and offcours rotate:
glRotate(direction, 0.0f, 1.0f, 0.0f);

i also set the gluLookAt to the coordinates to have a 3rd person view. which also works fine.
now on my pc the object always stays in the middle of the screen (or center of rotation).
on the mac the object alway translates by the factor of velocity from the center.

What could be the reson for that ? are the Translation and rotation matrixes differen on the mac than on the pc ?

Thanx for any suggestions.

fagery

nexusone
04-30-2003, 06:57 AM
No the openGL matrix functions are the same, it is most likly the math functions.

I on windows sin/cos return double values, could be in the conversion between you sin/cos and objposx.

I have had similar problem between diffrent compilers on windows and going between windows and linux.
Sometimes code has to be adjusted to run correctly.


Originally posted by fagery:
Hello all.
(I have posted this message in the mac forum as well. But i thought maby some one here know's a possible answer as well.)

I am coding a OpenGL based 3d Engine for the mac in my spare time. I have run into some problem with translations and Rotations.
I have for example some variables for the positions of a object let's say objposx objposy and objposz. To always move in the ahead direction i use following forumla:

objposx += sin(direction * 3.14 / 180) * velocity;
objposz += cos(direction * 3.14 / 180) * velocity;

after that i tranlate:
glTranslatef(objposx, objposy, objposz)
and offcours rotate:
glRotate(direction, 0.0f, 1.0f, 0.0f);

i also set the gluLookAt to the coordinates to have a 3rd person view. which also works fine.
now on my pc the object always stays in the middle of the screen (or center of rotation).
on the mac the object alway translates by the factor of velocity from the center.

What could be the reson for that ? are the Translation and rotation matrixes differen on the mac than on the pc ?

Thanx for any suggestions.

fagery

05-01-2003, 01:58 AM
Hi,
Thanx for the help.
The problem was effectivly just some bugs in my mac source. after fixing them it works great http://www.opengl.org/discussion_boards/ubb/smile.gif.

Regards

fagery