1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
9<title>GXBegin</title>
10</head>
11
12<body>
13
14<h1 align="left">GXBegin</h1>
15
16<h2>Syntax</h2>
17<dl><dd><pre class="construction">
18#include &lt;revolution/gx.h&gt;
19
20void GXBegin(<a href="../Enumerated_Types/GXPrimitive.html">GXPrimitive</a> type, <a href="../Enumerated_Types/GXVtxFmt.html">GXVtxFmt</a> vtxfmt, u16 nverts);
21</pre></dd></dl>
22
23<h2>Arguments</h2>
24<TABLE class="arguments" border="1" >
25  <tr>
26<TH>type</TH>
27<TD>Specifies the primitive type. <BR>Accepted values are:<BR>
28      <TABLE class="arguments" border="1" >
29          <tr>
30<TD bgcolor="#C0C0C0">Name</TD>
31<TD bgcolor="#C0C0C0">Primitive Type</TD>
32          </tr>
33          <tr>
34<TH>GX_POINTS</TH>
35<TD>Point.</TD>
36          </tr>
37          <tr>
38<TH>GX_LINES</TH>
39<TD>Line.</TD>
40          </tr>
41          <tr>
42<TH>GX_LINESTRIP</TH>
43<TD>Line strip.</TD>
44          </tr>
45          <tr>
46<TH>GX_TRIANGLES</TH>
47<TD>Triangle.</TD>
48          </tr>
49          <tr>
50<TH>GX_TRIANGLESTRIP</TH>
51<TD>Triangle strip.</TD>
52          </tr>
53          <tr>
54<TH>GX_TRIANGLEFAN</TH>
55<TD>Triangle fan.</TD>
56          </tr>
57          <tr>
58<TH>GX_QUADS</TH>
59<TD>Quad.</TD>
60          </tr>
61      </TABLE>
62      </TD>
63    </tr>
64  <tr>
65<TH>vtxfmt</TH>
66<TD>Specifies the vertex attribute format. <BR>This format is set using the <A href="GXSetVtxAttrFmt.html"><CODE>GXSetVtxAttrFmt</CODE></A> function before calling the <CODE>GXBegin</CODE> function. The following values are acceptable: <code>GX_VTXFMT0, GX_VTXFMT1, GX_VTXFMT2, GX_VTXFMT3, GX_VTXFMT4, GX_VTXFMT5, GX_VTXFMT6, GX_VTXFMT7</code>.</TD>
67    </tr>
68  <tr>
69<TH>nverts</TH>
70<TD>Specifies the number of vertices between <CODE>GXBegin</CODE> and <A href="GXEnd.html"><CODE>GXEnd</CODE></A>. <BR>The maximum number of vertices is 65535. The minimum number of vertices is the same as the minimum number of required primitive types.</TD>
71    </tr>
72</TABLE>
73
74<h2>Return Values</h2>
75<p>None.</p>
76
77<H2>Description</H2>
78<P>Use this function to begin drawing a graphics primitive. To draw a graphics primitive, a stream of vertex data matching the descriptions in both the <A href="GXSetVtxDesc.html"><CODE>GXSetVtxDesc</CODE></A> and <A href="GXSetVtxAttrFmt.html"><CODE>GXSetVtxAttrFmt</CODE></A> functions is enclosed between a <CODE>GXBegin</CODE>/<A href="GXEnd.html"><CODE>GXEnd</CODE></A> pair.</P>
79<P><CODE>GXClearVtxDesc();<BR> GXSetVtxDesc(GX_VA_POS, GX_INDEX8);<BR> GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);<BR> GXSetArray(GX_VA_POS, &amp;myverts[0], sizeof(f32) * 3 );</CODE></P>
80<P><CODE>GXBegin(GX_TRIANGLES, GX_VTXFMT0, 6);<BR> &nbsp;&nbsp;&nbsp; GXPosition1x8(0);&nbsp; // tri 0, vertex 0, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1x8(1);&nbsp; // tri 0, vertex 1, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1x8(2);&nbsp; // tri 0, vertex 2, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1x8(3);&nbsp; // tri 1, vertex 0, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1x8(4);&nbsp; // tri 1, vertex 1, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1x8(5);&nbsp; // tri 1, vertex 2, 8b index<BR> GXEnd();</CODE></P>
81<P>The number of vertices between <CODE>GXBegin</CODE> and <A href="GXEnd.html"><CODE>GXEnd</CODE></A> must match that specified by the <SPAN class="argument">nverts</SPAN> argument. The type of the primitive will determine the minimum number of vertices required.&nbsp;For example, a <code>GX_TRIANGLES</code> primitive must have at least three vertices.</P>
82<P>Primitives in which the vertex order is clockwise to the viewer are considered front-facing.</P>
83<P>
84Within <CODE>GXBegin</CODE> / <A href="GXEnd.html"><CODE>GXEnd</CODE></A>, a vertex stream is unable, on principle, to call any GX functions other than (<CODE><A href="GXPosition.html">GXPosition</A>, <A href="GXNormal.html">GXNormal</A>, <A href="GXColor.html">GXColor</A>, <A href="GXTexCoord.html">GXTexCoord</A>, <A href="GXMatrixIndex.html">GXMatrixIndex</A></CODE>).
85</P>
86
87<h2>See Also</h2>
88<p class="reference">
89<a href="GXEnd.html">GXEnd</a>,
90<a href="GXClearVtxDesc.html">GXClearVtxDesc</a>,
91<a href="GXSetVtxDesc.html">GXSetVtxDescv</a>,
92<a href="GXSetVtxAttrFmt.html">GXSetVtxAttrFmt</a>,
93<a href="GXSetVtxAttrFmtv.html">GXSetVtxAttrFmtv</a>,
94<a href="GXSetArray.html">GXSetArray</a>,
95<a href="GXPosition.html">GXPosition</a>,
96<a href="GXNormal.html">GXNormal</a>,
97<a href="GXColor.html">GXColor</a>,
98<a href="GXTexCoord.html">GXTexCoord</a>,
99<a href="GXMatrixIndex.html">GXMatrixIndex</a>
100</p>
101
102<H2>Revision History</H2>
103<P>
1042008/05/26 Corrected errors.<BR>2007/01/18 Revised <B>Description</B>.<BR>2006/03/01 Initial version.<br>
105</P>
106
107<hr><p>CONFIDENTIAL</p></body>
108</HTML>