21.06.2014 Views

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

OpenGL 4.2 (Compatibility Profile) - April 27, 2012

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.6. BEGIN/END PARADIGM 24<br />

2<br />

4<br />

2<br />

3<br />

4<br />

2<br />

4<br />

6<br />

1<br />

3<br />

5 1<br />

5<br />

1<br />

3<br />

5<br />

(a) (b) (c)<br />

Figure 2.4. (a) A triangle strip. (b) A triangle fan. (c) Independent triangles. The<br />

numbers give the sequencing of the vertices in order within the vertex arrays. Note<br />

that in (a) and (b) triangle edge ordering is determined by the first triangle, while in<br />

(c) the order of each triangle’s edges is independent of the other triangles.<br />

Polygons<br />

A polygon is described by specifying its boundary as a series of line segments.<br />

When Begin is called with POLYGON, the bounding line segments are specified in<br />

the same way as line loops. A polygon described with fewer than three vertices<br />

does not generate a primitive.<br />

The state required to support polygons consists of at least two processed vertices<br />

(more than two are never required, although an implementation may use<br />

more); this is because a convex polygon can be rasterized as its vertices arrive,<br />

before all of them have been specified.<br />

Triangle Strips<br />

A triangle strip is a series of triangles connected along shared edges, and may<br />

be specified with mode TRIANGLE_STRIP. In this case, the first three vertices<br />

define the first triangle (and their order is significant, just as for polygons). Each<br />

subsequent vertex defines a new triangle using that point along with two vertices<br />

from the previous triangle. If fewer than three vertices are specified, no primitive<br />

is produced. See figure 2.4.<br />

The required state consists of a flag indicating if the first triangle has been<br />

completed, two stored processed vertices, (called vertex A and vertex B), and a<br />

one bit pointer indicating which stored vertex will be replaced with the next vertex.<br />

After a Begin(TRIANGLE_STRIP), the pointer is initialized to point to vertex A.<br />

Each successive vertex toggles the pointer. Therefore, the first vertex is stored as<br />

<strong>OpenGL</strong> <strong>4.2</strong> (<strong>Compatibility</strong> <strong>Profile</strong>) - <strong>April</strong> <strong>27</strong>, <strong>2012</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!