#57464 - SevenString - Sun Oct 16, 2005 5:12 am
The "sqrtf32" function in LIBNDS/math.h returned incorrect results for me. The fix was to alter the function to shift-left (<<) by 13, NOT 12.
Normally, I tend to use tables, or avoid sqrts altogether when I can. But the problem that led to this discovery was that when using the libnds "glRotatef", the normalization function was not returning a unit vector. So I had to drill down to find the culprit.
I'm not sure if this is due to an emulation bug in iDeaS, or if this is an actual bug in libnds. To be honest, I'm too busy coding 3D stuff to bother drilling down into what the HW is actually doing vs. what the emulator may or may not be doing wrong.
However, if your 3D geometry is warping unpleasantly as you rotate, and you're using glRotatef, you might try altering sqrtf32 to use the << 13 trick. However, you'll need to rebuild the libnds source for this to work.
As a side note, many of the demos looked funky on the iDeaS emulator until I recompiled with this "fix".
_________________
"Artificial Intelligence is no match for natural stupidity."
Normally, I tend to use tables, or avoid sqrts altogether when I can. But the problem that led to this discovery was that when using the libnds "glRotatef", the normalization function was not returning a unit vector. So I had to drill down to find the culprit.
I'm not sure if this is due to an emulation bug in iDeaS, or if this is an actual bug in libnds. To be honest, I'm too busy coding 3D stuff to bother drilling down into what the HW is actually doing vs. what the emulator may or may not be doing wrong.
However, if your 3D geometry is warping unpleasantly as you rotate, and you're using glRotatef, you might try altering sqrtf32 to use the << 13 trick. However, you'll need to rebuild the libnds source for this to work.
As a side note, many of the demos looked funky on the iDeaS emulator until I recompiled with this "fix".
_________________
"Artificial Intelligence is no match for natural stupidity."