#include <revolution/gx.h>
void GXBegin(GXPrimitive type, GXVtxFmt vtxfmt, u16 nverts);
type |
specifies the primitive type Accepted values are:
|
||||||||||||||||
vtxfmt |
specifies the vertex attribute format This format is set using GXSetVtxAttrFmt before calling GXBegin. The following values are acceptable: GX_VTXFMT0, GX_VTXFMT1, GX_VTXFMT2, GX_VTXFMT3, GX_VTXFMT4, GX_VTXFMT5, GX_VTXFMT6 and GX_VTXFMT7 |
||||||||||||||||
nverts |
specifies the number of vertices between GXBegin and GXEndThe maximum number of vertices is 65,536. The minimum number of vertices is the same as the minimum number of required primitive types. |
None.
Use this function to begin drawing a graphics primitive. To draw a graphics primitive, a stream of vertex data matching the description of both GXSetVtxDesc and GXSetVtxAttrFmt is enclosed between GXBegin/GXEnd pairs.
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXSetArray(GX_VA_POS, &myverts[0], sizeof(f32));
GXBegin(GX_TRIANGLES, GX_VTXFMT0, 6);
GXPosition1u8(0); // tri 0, vertex 0, 8b index
GXPosition1u8(1); // tri 0, vertex 1, 8b index
GXPosition1u8(2); // tri 0, vertex 2, 8b index
GXPosition1u8(3); // tri 1, vertex 0, 8b index
GXPosition1u8(4); // tri 1, vertex 1, 8b index
GXPosition1u8(5); // tri 1, vertex 2, 8b index
GXEnd();
The number of vertices between GXBegin and GXEnd must match that specified by the nverts argument. The type of the primitive will determine the minimum number of vertices required. For example, a GX_TRIANGLES primitive must have at least three vertices.
Primitives in which the vertex order is clockwise to the viewer are considered front-facing.
GXEnd
GXClearVtxDesc
GXSetVtxDescv
GXSetVtxAttrFmt
GXSetVtxAttrFmtv
GXSetArray
GXPosition
GXNormal
GXColor
GXTexCoord
GXMatrixIndex
03/01/2006 Initial version.