21.06.2014 Views

OpenGL 4.1 (Compatibility Profile) - July 25, 2010

OpenGL 4.1 (Compatibility Profile) - July 25, 2010

OpenGL 4.1 (Compatibility Profile) - July 25, 2010

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.6. BEGIN/END PARADIGM 23<br />

first vertex. The required state consists of the processed first vertex, in addition to<br />

the state required for line strips.<br />

Separate Lines<br />

Individual line segments, each specified by a pair of vertices, may be specified<br />

with mode LINES. The first two vertices between a Begin and End pair define the<br />

first segment, with subsequent pairs of vertices each defining one more segment.<br />

If the number of specified vertices is odd, then the last one is ignored. The state<br />

required is the same as for line strips but it is used differently: a processed vertex<br />

holding the first vertex of the current segment, and a boolean flag indicating<br />

whether the current vertex is odd or even (a segment start or end).<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 />

vertex A, the second stored as vertex B, the third stored as vertex A, and so on.<br />

Any vertex after the second one sent forms a triangle from vertex A, vertex B, and<br />

the current vertex (in that order).<br />

Triangle Fans<br />

A triangle fan is the same as a triangle strip with one exception: each vertex<br />

<strong>OpenGL</strong> <strong>4.1</strong> (<strong>Compatibility</strong> <strong>Profile</strong>) - <strong>July</strong> <strong>25</strong>, <strong>2010</strong>

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

Saved successfully!

Ooh no, something went wrong!