gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Updated devkitARM (and libnds), and now objects are inverted

#130993 - DiscoStew - Sat Jun 09, 2007 11:12 pm

Ok, I recently updated to the newest version of DevKitARM (I can't remember which version I previously had, but I suppose a lot of changes took place in between), and now, all the models and manual drawing of faces look to be inverted vertically, as if the axis of positive Y got inverted, insomuch that instead of +Y going up, it is going down. Sorry if this is hard to explain.

Say I am looking straight down the Z axis, with -Z being forward of the camera, with +X going to the right, and +Y going up. When placing a vertex with a positive Y value, it would to be above the horizon, but after updating my stuff, the same code is now placing that vertex under the horizon. Was this an intentional change?


Also something I assume is related, but in both the old version and new version, when I'd rotate an object on the Z axis positively, both would rotate in the same direction, clockwise.

EDIT:
Changed title from ndslib to libnds).
_________________
DS - It's all about DiscoStew


Last edited by DiscoStew on Sun Jun 10, 2007 12:30 am; edited 1 time in total

#130998 - tondopie - Sun Jun 10, 2007 12:13 am

if you updated ndslib, then thats your problem! the newest DKA is for libnds

#131002 - DiscoStew - Sun Jun 10, 2007 12:29 am

Oops, my mistake. It is libnds.
_________________
DS - It's all about DiscoStew

#131026 - DiscoStew - Sun Jun 10, 2007 8:26 am

For another perspective of what I'm describing..

[Images not permitted - Click here to view it]

The left image is the actual NeHe Lesson 4 in OpenGL.
The right image is the DS equivalent of NeHe Lesson 4 running on No$GBA 2.3

Though I am using an emulator rather than hardware (hope to change that soon), I can tell you that it is not an emulator problem, as I have been using the same emulator before I updated my DevKitARM, and my compiled projects were not flipped vertically as shown on the right.

Has no one encountered this kind of problem, or was it meant to be this way? I just don't like the idea about having to alter all my stuff to accommodate this change, especially since it seemed ok before.
_________________
DS - It's all about DiscoStew

#131063 - Sausage Boy - Sun Jun 10, 2007 7:56 pm

Try playing with some minus signs in the initialization code. I think there is some way to change it in some function call there.
_________________
"no offense, but this is the gayest game ever"

#131072 - DiscoStew - Sun Jun 10, 2007 9:25 pm

Sausage Boy,

Thanks for your suggestion. From what I can tell, the only part where I can change any initialization code that affect the matrix would be through gluPerspective, plus also glFrustumf32 (because gluPerspective uses it). Everything else seems to either not be affiliated with changing the current matrix, or I just cannot get to, as it is most likely compiled into the libnds library.

I've tinkered with those 2 functions, and have changed it to where I can get them to not be inverted anymore, but now I have the problem of rotation. I can get the pyramid to rotate correctly, as it rotating on only 1 axis, but the cube is on all 3, and I just can't seem to change the code to the point where I am mimicking what OpenGL does.
_________________
DS - It's all about DiscoStew

#131087 - DiscoStew - Sun Jun 10, 2007 11:45 pm

Well, I'd like to apologize, as I found the main problem of why everything was inverted.

It was the emulator. I updated that to the newest version, and now everything is as it should be, minus the rotation problem which I've had since I started. The only thing I can think of that would result in this odd behavior is that both the tool kit and the emulator were going off incorrect data, and when the toolkit got updated correctly, the emulator must have got updated shortly after so it would go with the correct changes, and I had only updated the toolkit, resulting in the problem until the emulator was updated.

I had even gone to the lengths to find out just how gluPerspective and glFrustum worked, and comparing to the current code, only the glFrustum had a single switch-a-roo of 2 lines, but after switching them, I got nothing on the screen. Looking at it, I could only conclude that the reason why the switch was made was because of where the Position elements were, and it made sense.

So now, everything works, except for the rotation problem I've had for a while. The pyramid still turns to the left, but now the cube is rotating down and to the right. After just examining how they are rotating, to me, it looks like a possible inverted axis problem, where instead of rotating in one direction, it is going into the opposite. So I went to the rotation functions being used, and negated the unit vector axis of all 3, and now, it is rotating just how it does with the NeHe OpenGL example. For fun, I instead negated the rotation value, and got the same result.

I'm glad that is the only change I would need to make. Thank for your help.
_________________
DS - It's all about DiscoStew

#131109 - Dark Knight ez - Mon Jun 11, 2007 7:51 am

Yeah, it's known that the rotation in libnds is exactly the opposite of the rotation on the PC.
Good job on figuring that out yourself. :)
_________________
AmplituDS website