#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. They can be called only between the GXBegin function and the GXEnd function. Function names take the following format:
GXColor[n][t]
The [n] function name parameter has a value of 1, 3, or 4, and indicates the number of arguments to the function. The [t] function name parameter 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 an unsigned (u) or index (x) data type. The subsequent number indicates the bit size. For example, u8 indicates an unsigned 8-bit data type. For example, the GXColor1u32 function takes 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 the GXSetVtxAttrFmt function.
Vertex functions must be called in the order specified by the GXSetVtxDesc function. Each vertex must send attributes (position coordinates, colors, normals, and so forth) in the specified order to guarantee proper parsing by the graphics hardware.
When an attribute is indexed (meaning its type, set by the GXSetVtxDesc function, is GX_INDEX8 or GX_INDEX16), the vertex function specifies an index to the data, not the data itself. The location of the array that will be indexed is described using the GXSetArray function. If an attribute is direct (meaning its type, set by the GXSetVtxDesc function, is GX_DIRECT), the vertex function sends the data. No vertex function should be called for an attribute that is disabled (that is, its type, set by the GXSetVtxDesc function, 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 actual functions in the debug version of the GX 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] functions are used in relation to the color attribute format. For example, if you want to use 32-bit color per vertex, each function shown below is equally valid. Which 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
2006/03/01 Initial version.
CONFIDENTIAL