Vertex formats...
Posted: Sun Nov 09, 2008 8:58 pm
I'm a bit confused by vertex formats and vertex descriptions in libogc, for example:
So GX_SetVtxAttrFmt takes a GX_VTXFMT0 format argument, but GX_SetVtxDesc doesn't. I looked through the code in libogc, and it always writes the vertex description into CP registers 0x50/0x60.
If you look into YAGCD, there should be one vertex description for each vertex format. Or is that Wii-only hardware? Otherwise I don't see the point in being able to declare several formats, if the actual declaration has to consist of the same elements each time. Or are you expected to send a new declaration whenever you render primitives with a different format?
Code: Select all
GX_ClearVtxDesc();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxDesc(GX_VA_NBT, GX_DIRECT);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_NBT, GX_NRM_NBT, GX_F32, 0);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
If you look into YAGCD, there should be one vertex description for each vertex format. Or is that Wii-only hardware? Otherwise I don't see the point in being able to declare several formats, if the actual declaration has to consist of the same elements each time. Or are you expected to send a new declaration whenever you render primitives with a different format?