#86666 - Valmond - Thu Jun 08, 2006 4:18 pm
Hi everybody !
I'd like to make some 3D on the DS, and what I'v understood,
displaylists is the way to go.
So I'v spent some time googling and searching and well, the thing
that's I'm missing is more something like, how do you actually
create the list and with what ?
In the opengl part I bet it's quite straight forward (push Matrices and
dump the list somewhere right ?) but I don't have a clue on how the
displaylist itself could be created (how do I do a MATRIX_RESTORE
and how to store vertexes etc. what kind of format is this in anyway ?)...
So if any nice soul out there has any informations (or a link :-) I'd
greatly appreciate !
Thanks for your time
/Valmond
#86673 - Valmond - Thu Jun 08, 2006 4:59 pm
Well I think I'v found half the secret (funny you often do just when you'v asked for help :p)
#define GFX_FIFO (*(vuint32*) 0x04000400)
use (def in video.h) GFX_FIFO=a_command
repeatedly is the way to do it ?
Then again, I dont really get what kind of commands
(or how to use them) there are...
/Valmond
#86675 - Sausage Boy - Thu Jun 08, 2006 5:03 pm
Check out the first display list demo in the nds examples for creating lists manually. Of course, you want to make a 3d exporter or something that generates the display lists for you.
_________________
"no offense, but this is the gayest game ever"
#86676 - Valmond - Thu Jun 08, 2006 5:07 pm
But offcourse !
I'll dig into that, thanks !
/Valmond
#86679 - Sausage Boy - Thu Jun 08, 2006 5:21 pm
No problem. If you wonder anything, please ask and I'll try to explain.
_________________
"no offense, but this is the gayest game ever"
#86680 - parrot_ - Thu Jun 08, 2006 5:27 pm
AFAIK FIFO can only transfer a byte at a time, at least, thats how DSTek documents the IPC FIFO.
_________________
Squak! etc.
My Blog
#86687 - SteveH - Thu Jun 08, 2006 6:06 pm
From what I understand a display list is basically a list of u32's, each u32 is part of a command, and the basic format is:
u32 - Command options (start, vertex, colour info etc, 1 byte per command)
u32 for command 1
u32 for command 2
u32 for command 3
u32 for command 4
u32 commands options
u32 for command 1
u32 for command 2
u32 for command 3
u32 for command 4
repeated (well that's what it looks like in the teapot example). I am currently still slowly working though the teapot data file, and looking at the FIFO registers, but at this moment in time I think I could create an obj - display list converter, that used only very basic parts of the display list format.
#86804 - Sausage Boy - Fri Jun 09, 2006 1:40 pm
Yes SteveH, that's almost true. But beware, some commands use 2 u32's, and some use none. The vertex coordinate command, for example, uses 2 afaik, and the NOP command uses none.
_________________
"no offense, but this is the gayest game ever"
#86809 - Valmond - Fri Jun 09, 2006 3:22 pm
>each u32 is part of a command
Isn't it the other way around, a command is a part of a u32 ?
What I have understood looking at the example is that
there are two sorts of data ;
one that tells what kind of data is coming (the next 4)
and the data itself which is variable sized.
[EDIT] uh, or exactly what Sausage Boy said :p[/EDIT]
in the example :
GL_TRIANGLE (to tell we want to draw tris) is a byte and goes with FIFO_BEGIN
RGB15() is, well, 16bits so 2 bytes and goes with FIFO_COLOR
VERTEX_PACK two times is 4 bytes and goes with FIFO_VERTEX16
etc...
so basically it should be quite easy to create those lists (except that
they dont run ok in Dualis :p) and after gl-setup, just set a texture, the
right matrix and write the list to draw textured meshes, right ?
Well, if thats roughly how it's works, then I'v got another question :)
I'v read that you can push/pop matrices (read/store command ?) in
a displaylist, this could be nice for skeletal animation where you
need to calculate the matrices at runtime (and pre-push them
onto the matrix stack before flushing the displaylist).
I'v read somewhere that the DS doesn't use indexed vertexlists,
so how can you set different matrices to for example the 3 vertexes
in a triangle (without a whole load of matrix stack operations) ?
I mean, you can't (as far as I have understood) set a matrix, flush
a bunch of vertexes, set another matrix, flush more vertexes, then flush
triangles using any of these vertexes...
Or can you ?
/Valmond
#86818 - ecurtz - Fri Jun 09, 2006 3:58 pm
It doesn't store the vertices, you have to submit them as part of a triangle (or quad). Other than that your description is basically right.
I posted some code in this thread you may want to take a look at. Incomplete, but a good place to start