GXPosition

Syntax

#include <revolution/gx.h>

void GXPosition3f32( f32 x, f32 y, f32 z );
void GXPosition3u16( u16 x, u16 y, u16 z );
void GXPosition3s16( s16 x, s16 y, s16 z );
void GXPosition3u8 ( u8  x, u8  y, u8  z );
void GXPosition3s8 ( s8  x, s8  y, s8  z );

void GXPosition2f32( f32 x, f32 y );
void GXPosition2u16( u16 x, u16 y );
void GXPosition2s16( s16 x, s16 y );
void GXPosition2u8 ( u8  x, u8  y );
void GXPosition2s8 ( s8  x, s8  y );

void GXPosition1x16( u16 index );
void GXPosition1x8 ( u8  index );

Arguments

Will depend on function used.

Return Values

None.

Description

These functions are used to specify position data for a vertex. It can be called only between the GXBegin function and the GXEnd function. Function names take the following format:

GXPosition[n][t]

The n function name parameter is 1, 2, or 3, and describes the number of function arguments. The t function name parameter describes the type of each argument to the function and can be one of the following values: s8, u8, s16, u16, f32, x8, or x16. The type letter indicates signed (s), unsigned (u), floating point (f), and index (x) data types. The subsequent number indicates the bit size. For example, u8 indicates an unsigned 8-bit data type. For example, GXPosition3f32 expects three floating point arguments. If only two arguments are specified (if GX_POS_XY is specified for cnt in GXSetVtxAttrFmt), then only the texture coordinate X and Y components are specified, and the Z component is treated as 0.

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 GXPosition[n][t] functions are implemented as inline functions in the non-debug version of the GX library for optimal performance. The GXPosition[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).

See Also

GXBegin, GXEnd, GXSetVtxDesc, GXSetVtxAttrFmt

Revision History

2008/06/20 Expanded the description of the case where only two arguments are specified.
2006/03/01 Initial version.


CONFIDENTIAL