#include <revolution/gx.h>
void GXColor4u8 ( u8 r, u8 g, u8 b, u8 a );
void GXColor3u8 ( u8 r, u8 g, u8 b );
void GXColor1u32( u32 clr );
void GXColor1u16( u16 clr );
void GXColor1x16( u16 index );
void GXColor1x8 ( u8 index );
Depends on the function being called.
None.
These functions are used to specify color data for a vertex. It can only be called between GXBegin and GXEnd. Function names take the following format:
GXColor[n][t]
The function name parameter n describes the number of arguments to the function and can be either 1, 3, or 4 in value. The function name parameter t describes the type of each argument to the function and can have a value of u8, u16, u32, x8, or x16. The type letter indicates either unsigned (u) or index (x) data types. The subsequent number indicates the data's size in bits. For example, u8 indicates an unsigned 8-bit quantity. For example, GXColor1u32 expects one unsigned 32-bit argument.
The selected function must correspond to the current vertex descriptor and the vertex attribute format specified in the GXBegin function. The current vertex descriptor is set using the GXSetVtxDesc function. The vertex attribute format is set using GXSetVtxAttrFmt.
The order in which vertex functions must be called is specified by the GXSetVtxDesc function. Each vertex must send attributes (positions, colors, normals, etc.) in the specified order to guarantee proper interpretation by the graphics hardware.
When an attribute is indexed (i.e., its type, set by GXSetVtxDesc, is GX_INDEX8 or GX_INDEX16), the vertex function will specify an index to the data, not the data itself. The location of the array that will be indexed is described using GXSetArray. When an attribute is direct (i.e., its type, set by GXSetVtxDesc, is GX_DIRECT), the vertex function sends the data. No vertex function should be called for an attribute which is disabled (i.e., its type, set by GXSetVtxDesc, is GX_NONE). However, every vertex must at least enable GX_VA_POS.
The GXColor[n][t] functions are implemented as inline functions in the non-debug version of the GX library for optimal performance. The GXColor[n][t] functions are implemented as functions in the debug version of the library so it can verify the correct order of vertex function calls between GXBegin and GXEnd (a common source of errors).
There is some flexibility in how the GXColor[n][t] function is used in relation to the color attribute format. For example, if you want to use a 32-bit color per vertex, each function shown below is equally valid. The one to use will depend on the application.
GXColor4u8( 0xff, 0x00, 0xff, 0x80 );
GXColor1u32( 0xff00ff80 );
The following macros are provided for packing color data into 16-bit formats:
GXBegin
GXEnd
GXSetVtxDesc
GXSetVtxAttrFmt
03/01/2006 Initial version.