23.06.2013 Views

The OpenGL Graphics System: A Specification

The OpenGL Graphics System: A Specification

The OpenGL Graphics System: A Specification

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 16<br />

<strong>The</strong> required state consists of the processed vertex produced from the last vertex<br />

that was sent (so that a line segment can be generated from it to the current<br />

vertex), and a boolean flag indicating if the current vertex is the first vertex.<br />

Line Loops. Line loops, specified with the LINE LOOP argument value to<br />

Begin, are the same as line strips except that a final segment is added from the final<br />

specified vertex to the first vertex. <strong>The</strong> additional state consists of the processed<br />

first vertex.<br />

Separate Lines. Individual line segments, each specified by a pair of vertices,<br />

are generated by surrounding vertex pairs with Begin and End when the value<br />

of the argument to Begin is LINES. In this case, the first two vertices between a<br />

Begin and End pair define the first segment, with subsequent pairs of vertices each<br />

defining one more segment. If the number of specified vertices is odd, then the last<br />

one is ignored. <strong>The</strong> state required is the same as for lines but it is used differently: a<br />

vertex 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. A polygon is described by specifying its boundary as a series of<br />

line segments. When Begin is called with POLYGON, the bounding line segments<br />

are specified in the same way as line loops. Depending on the current state of the<br />

GL, a polygon may be rendered in one of several ways such as outlining its border<br />

or filling its interior. A polygon described with fewer than three vertices does not<br />

generate a primitive.<br />

Only convex polygons are guaranteed to be drawn correctly by the GL. If a<br />

specified polygon is nonconvex when projected onto the window, then the rendered<br />

polygon need only lie within the convex hull of the projected vertices defining its<br />

boundary.<br />

<strong>The</strong> 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. <strong>The</strong> order of the vertices is significant in<br />

lighting and polygon rasterization (see sections 2.14.1 and 3.5.1).<br />

Triangle strips. A triangle strip is a series of triangles connected along shared<br />

edges. A triangle strip is specified by giving a series of defining vertices between<br />

a Begin/End pair when Begin is called with TRIANGLE STRIP. In this case, the<br />

first three vertices define the first triangle (and their order is significant, just as for<br />

polygons). Each subsequent vertex defines a new triangle using that point along<br />

with two vertices from the previous triangle. A Begin/End pair enclosing fewer<br />

than three vertices, when TRIANGLE STRIP has been supplied to Begin, produces<br />

no primitive. See figure 2.4.<br />

<strong>The</strong> state required to support triangle strips consists of a flag indicating if the<br />

first triangle has been completed, two stored processed vertices, (called vertex A<br />

Version 2.0 - October 22, 2004

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

Saved successfully!

Ooh no, something went wrong!