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 > 3d question

#93285 - ProblemBaby - Tue Jul 18, 2006 10:20 am

I want to set up an orthogonal view where 0,0 is located in the left upper corner and 255,191 in the right lower, how is that done?
I also want to display one texture that will be updated each frame, where should this be done to not flicker do I need two and then swap between them?

a little pseudo code example would be great!
thanks

#93315 - Sausage Boy - Tue Jul 18, 2006 4:25 pm

For some info about your first question, check out my article,
http://www.gasp.boxgamex.net/?p=6.
Note that one "3d unit" is actually made up of many, many small, since it's represented with fixed point math.

For animation, if you want to do it the same way as you usually animate sprites, you'd write the new texture to vram every once in a while. However, libnds's 3d implemention does not (afaik) tell you where it has loaded your textures, so you'd basically have to write a little mini 3d lib with a texture manager. It's not as hard as it sounds, though.

Another way is to load all the frames into vram, and then just binding different textures depending on which frame you need.

Both approaches work (I think), but the second takes a lot more memory. I'd recommend starting with number 2, and then, as you gain more knowledge about the DS's 3d hardware, move to the first.
_________________
"no offense, but this is the gayest game ever"

#95156 - ProblemBaby - Fri Jul 28, 2006 2:41 am

two questions...

1. the projection is upside down I thought scale with 1,-1,1 and then translate y down would solve it but I cant get it to work.

2. My texture is only updated once... some pseudo
vramacnt = 0x80

write to vram A

vramacnt = 0x83

glReset
set projection
set model matrix mode
render quad
flush
WaitforVBL

in the TextureViewer in dualis I can see the correct texture but the output is the same as the first time. (it doesnt hang).