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>C Specification</h2>
17
18<dl>
19<dd><pre><CODE>#include &lt;revolution/gx.h&gt;</CODE></pre>
20  </dd>
21<dd><pre><CODE>void GXBegin(<a href="../Enumerated_Types/GXPrimitive.html">GXPrimitive</a> <em>type</em>, <a href="../Enumerated_Types/GXVtxFmt.html">GXVtxFmt</a> <em>vtxfmt,</em> u16 nverts);</CODE></pre>
22  </dd>
23</dl>
24
25<h2>Arguments</h2>
26<TABLE border="1" cellpadding="3" cellspacing="0.1">
27  <tr>
28<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>type</CODE></strong></em></TD>
29<TD width="520">specifies the primitive type <BR>Accepted values are:<BR>
30      <TABLE width="500" border="1" cellspacing="0.1">
31
32          <tr>
33<TD width="150" bgcolor="#C0C0C0">Name</TD>
34<TD width="350" bgcolor="#C0C0C0">Primitive Type</TD>
35          </tr>
36          <tr>
37<TD width="150"><code>GX_POINTS</code></TD>
38<TD width="350">points</TD>
39          </tr>
40          <tr>
41<TD width="150"><code>GX_LINES</code></TD>
42<TD width="350">lines</TD>
43          </tr>
44          <tr>
45<TD width="150"><code>GX_LINESTRIP</code></TD>
46<TD width="350">line strip</TD>
47          </tr>
48          <tr>
49<TD width="150"><code>GX_TRIANGLES</code></TD>
50<TD width="350">triangles</TD>
51          </tr>
52          <tr>
53<TD width="150"><code>GX_TRIANGLESTRIP</code></TD>
54<TD width="350">triangle strips</TD>
55          </tr>
56          <tr>
57<TD width="150"><code>GX_TRIANGLEFAN</code></TD>
58<TD width="350">triangle fans</TD>
59          </tr>
60          <tr>
61<TD width="150"><code>GX_QUADS</code></TD>
62<TD width="350">quad</TD>
63          </tr>
64
65      </TABLE>
66      </TD>
67    </tr>
68  <tr>
69<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>vtxfmt</CODE></strong></em></TD>
70<TD width="520">specifies the vertex attribute format <BR>This format is set using <A href="GXSetVtxAttrFmt.html"><CODE>GXSetVtxAttrFmt</CODE></A> before calling <A href="GXBegin.html"><CODE>GXBegin</CODE></A>. The following values are acceptable: <CODE>GX_VTXFMT0</CODE>, <CODE>GX_VTXFMT1</CODE>, <CODE>GX_VTXFMT2</CODE>, <CODE>GX_VTXFMT3</CODE>, <CODE>GX_VTXFMT4</CODE>, <CODE>GX_VTXFMT5</CODE>, <CODE>GX_VTXFMT6</CODE> and <CODE>GX_VTXFMT7</CODE></TD>
71    </tr>
72  <tr>
73<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>nverts</CODE></strong></em></TD>
74<TD width="520">specifies the number of vertices between <CODE><A href="GXBegin.html">GXBegin</A></CODE> and <CODE><A href="GXEnd.html">GXEnd</A></CODE><BR>The maximum number of vertices is 65,536. The minimum number of vertices is the same as the minimum number of required primitive types.</TD>
75    </tr>
76</TABLE>
77<h2>Return Values</h2>
78
79<p>None.</p>
80<H2>Description</H2>
81<P>Use this function to begin drawing a graphics primitive.&nbsp;To draw a graphics primitive, a stream of vertex data matching the description of both <a href="GXSetVtxDesc.html"><code>GXSetVtxDesc</code></a> and <a href="GXSetVtxAttrFmt.html"><code>GXSetVtxAttrFmt</code></a> is enclosed between <code><a href="GXBegin.html">GXBegin</a>/<a href="GXEnd.html">GXEnd</a></code> pairs.</P>
82<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));</CODE></P>
83<P><CODE>GXBegin(GX_TRIANGLES, GX_VTXFMT0, 6);<BR> &nbsp;&nbsp;&nbsp; GXPosition1u8(0);&nbsp; // tri 0, vertex 0, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1u8(1);&nbsp; // tri 0, vertex 1, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1u8(2);&nbsp; // tri 0, vertex 2, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1u8(3);&nbsp; // tri 1, vertex 0, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1u8(4);&nbsp; // tri 1, vertex 1, 8b index<BR> &nbsp;&nbsp;&nbsp; GXPosition1u8(5);&nbsp; // tri 1, vertex 2, 8b index<BR> GXEnd();</CODE></P>
84<P>The number of vertices between <code><a href="GXBegin.html">GXBegin</a></code> and <code><a href="GXEnd.html">GXEnd</a></code> must match that specified by the <code>nverts</code> argument.&nbsp;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>
85<P>Primitives in which the vertex order is clockwise to the viewer are considered front-facing.</P>
86
87<h2>See Also</h2>
88
89<p><a href="GXEnd.html"><CODE>GXEnd</CODE></a><br> <a href="GXClearVtxDesc.html"><CODE>GXClearVtxDesc</CODE></a><br> <a href="GXSetVtxDesc.html"><CODE>GXSetVtxDescv</CODE></a><br> <a href="GXSetVtxAttrFmt.html"><CODE>GXSetVtxAttrFmt</CODE></a><br> <a href="GXSetVtxAttrFmtv.html"><CODE>GXSetVtxAttrFmtv</CODE></a><br> <a href="GXSetArray.html"><CODE>GXSetArray</CODE></a><br> <a href="GXPosition.html"><CODE>GXPosition</CODE></a><br> <a href="GXNormal.html"><CODE>GXNormal</CODE></a><br> <a href="GXColor.html"><CODE>GXColor</CODE></a><br> <a href="GXTexCoord.html"><CODE>GXTexCoord</CODE></a><br> <a href="GXMatrixIndex.html"><CODE>GXMatrixIndex</CODE></a></p>
90<H2>Revision History</H2>
91<P>03/01/2006 Initial version.</P>
92</BODY>
93</HTML>