Hello all.
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:
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 ?
glTranslatef & glRotatef work identically on the two platforms. I can’t think what might be going on except that floating-point math is likely to be more accurate on the Mac than on the PC.
Originally posted by OneSadCookie: floating-point math is likely to be more accurate on the Mac than on the PC.
Hu? Why would it be? To my knowledge they both use 32 and 64 bits IEEE floating point format, and I believe the x87 even have an advantage over the PPC with its 80bits internal floating point coding. [I think the PPC works on 64 but I’m not sure].
The PowerPC’s FPU is a very accurate implementation of the IEEE754 standards (and works with both 32- and 64-bit floating point numbers).
Intel’s FPU is a very inaccurate 80-bit unit. In practice, even 32-bit FP math on the PowerPC seems to be more accurate than 80-bit math on Intel. float and double data types on Intel do follow the IEEE754 standard, but when you do math on them they get converted to 80 bit.
I believe that Intel’s SSE unit is about as good as the PowerPC’s FPU. Some compilers (such as GCC) have options to do all FP math in the SSE unit, which is usually worth doing.