1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<TITLE>GXColor[n][t]</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">GXColor</H1> 12<H2>C Specification</H2> 13<DL> 14 <DD> 15<PRE><CODE>#include <revolution/gx.h></CODE></PRE> 16 <DD> 17<PRE><CODE>void GXColor4u8 ( u8 r, u8 g, u8 b, u8 a ); 18 19void GXColor3u8 ( u8 r, u8 g, u8 b ); 20 21void GXColor1u32( u32 clr ); 22void GXColor1u16( u16 clr ); 23 24void GXColor1x16( u16 index ); 25void GXColor1x8 ( u8 index );</CODE></PRE> 26</DL> 27<H2>Arguments</H2> 28<P>Depends on the function being called.</P> 29<H2>Return Values</H2> 30<P>None.</P> 31<H2>Description</H2> 32<P>These functions are used to specify color data for a vertex. It can only be called between <a href="GXBegin.html"><code>GXBegin</code></a> and <a href="GXEnd.html"><code>GXEnd</code></a>. Function names take the following format:</P> 33<P><CODE>GXColor[n][t]</CODE></P> 34<P> </P> 35<P>The function name parameter <code>n</code> describes the number of arguments to the function and can be either 1, 3, or 4 in value. The function name parameter <code>t</code> 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 (<CODE>u</CODE>) or index (<code>x</code>) data types. The subsequent number indicates the data's size in bits. For example, <code>u8</code> indicates an unsigned 8-bit quantity. For example, <code>GXColor1u32</code> expects one unsigned 32-bit argument.</P> 36<P>The selected function must correspond to the current vertex descriptor and the vertex attribute format specified in the <a href="GXBegin.html"><code>GXBegin</code></a> function. The current vertex descriptor is set using the <a href="GXSetVtxDesc.html"><code>GXSetVtxDesc</code></a> function. The vertex attribute format is set using <a href="GXSetVtxAttrFmt.html"><code>GXSetVtxAttrFmt</code></a>.</P> 37<P>The order in which vertex functions must be called is specified by the <a href="GXSetVtxDesc.html"><code>GXSetVtxDesc</code></a> function. Each vertex must send attributes (positions, colors, normals, etc.) in the specified order to guarantee proper interpretation by the graphics hardware. </P> 38<P>When an attribute is indexed (i.e., its type, set by <a href="GXSetVtxDesc.html"><code>GXSetVtxDesc</code></a>, is <code>GX_INDEX8</code> or <code>GX_INDEX16</code>), 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 <a href="GXSetArray.html"><code>GXSetArray</code></a>. When an attribute is direct (i.e., its type, set by <a href="GXSetVtxDesc.html"><code>GXSetVtxDesc</code></a>, is <code>GX_DIRECT</code>), the vertex function sends the data. No vertex function should be called for an attribute which is disabled (i.e., its type, set by <a href="GXSetVtxDesc.html"><code>GXSetVtxDesc</code></a>, is <code>GX_NONE</code>). However, every vertex must at least enable <code>GX_VA_POS</code>.</P> 39<P>The <code>GXColor[n][t]</code> functions are implemented as inline functions in the non-debug version of the GX library for optimal performance. The <code>GXColor[n][t]</code> functions are implemented as functions in the debug version of the library so it can verify the correct order of vertex function calls between <CODE><a href="GXBegin.html">GXBegin</a></CODE> and <CODE><a href="GXEnd.html">GXEnd</a></CODE> (a common source of errors).</P> 40<P>There is some flexibility in how the <CODE>GXColor[n][t]</CODE> 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.</P> 41<P><CODE>GXColor4u8( 0xff, 0x00, 0xff, 0x80 );<BR> GXColor1u32( 0xff00ff80 );</CODE></P> 42<P>The following macros are provided for packing color data into 16-bit formats:</P> 43<P><CODE><A href="../ColorFormat/GXPackedRGB565.html">GXPackedRGB565</A><BR> <A href="../ColorFormat/GXPackedRGBA4.html">GXPackedRGBA4</A></CODE></P> 44<H2>See Also</H2> 45<P><CODE><A href="GXBegin.html">GXBegin</A> <BR> <A href="GXEnd.html">GXEnd</A><BR> <A href="GXSetVtxDesc.html">GXSetVtxDesc</A><BR> <A href="GXSetVtxAttrFmt.html">GXSetVtxAttrFmt</A></CODE></P> 46<H2>Revision History</H2> 47<P>2006/03/01 Initial version.</P> 48<hr> 49<P>CONFIDENTIAL</p> 50</BODY> 51</HTML>