Page 1 of 1

Trying to draw a triangle atop the sprites example [solved]

Posted: Wed May 20, 2009 1:41 am
by Josh @ Dreamland
In summary, I was having problems getting the Wii to work going from drawing primitives with textures to drawing them with colors.

These are two functions I threw together in a long trial and error process. Maybe someone will find them useful, or maybe they were out there already and I didn't see them.

Either way, these are my buddies, so you can have them.

Code: Select all

void goColor()
{
  GX_SetNumTexGens(0);
  GX_InvVtxCache();
  GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
  GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0); 
  
  GX_ClearVtxDesc();
  GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
  GX_SetVtxDesc(GX_VA_TEX0, GX_NONE);
  GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
}

void goTexture()
{
  GX_ClearVtxDesc();
  GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
  GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
  GX_SetVtxDesc(GX_VA_CLR0, GX_NONE);
  
  GX_SetNumTexGens(1);
  GX_SetTevOp(GX_TEVSTAGE0, GX_REPLACE);
  GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
}
Happy coding.