Page 1 of 1

Looking for guidance

Posted: Wed Apr 17, 2013 7:19 pm
by psycorpse
I am picking wii dev back up and it has been a long time. Not that I was good back then however I am attempting to get into using libogc and gx (maybe the same?). I can get sprites to the screen with no problem however I am looking to implement fading on the sprites. How might I do this and or where can I read about it. I have seen the doxygen docs however I don't even know what I am looking for. If there is some likeness between opengl and gx and there is a good book that you can recommend that would be great too.

Thanks,
Mike

Re: Looking for guidance

Posted: Tue Apr 23, 2013 8:40 pm
by psycorpse
Well just for future reference I think I have figured it out. At least it is working for me. If I am doing something wrong feel free to let me know.

In the Draw Method you will need to switch the TEVSTAGE to MODULATE and in your GX_Color4u8(r, g, b, a) the a will control the transparency on the object that you are drawing.

Note: alpha is a value between 0 and 255 (255 fully visible and 0 fully transparent)

Here is a snip of my draw code.

Code: Select all

// SNIP
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);

GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
  GX_Position2f32(x, y);
  GX_Color4u8(255, 255, 255, alpha); // Use white as it will not tint the texture
  GX_TexCoord2f32(tex_x, tex_y);

  GX_Position2f32(x + w, y);
  GX_Color4u8(255, 255, 255, alpha); // Use white as it will not tint the texture
  GX_TexCoord2f32(tex_x + tex_w, tex_y);

  GX_Position2f32(x + w , y + h);
  GX_Color4u8(255, 255, 255, alpha); // Use white as it will not tint the texture
  GX_TexCoord2f32(tex_x + tex_w, tex_y + tex_h);

  GX_Position2f32(x, y + h);
  GX_Color4u8(255, 255, 255, alpha); // Use white as it will not tint the texture
  GX_TexCoord2f32(tex_x, tex_y + tex_h);
GX_End();

// End SNIP