*** Welcome to piglix ***

Triangle strip


A triangle strip is a series of connected triangles, sharing vertices, allowing for more efficient memory usage for computer graphics. They are more efficient than triangle lists without indexing, but usually equally fast or slower than indexed triangle lists. The primary reason to use triangle strips is to reduce the amount of data needed to create a series of triangles. The number of vertices stored in memory is reduced from 3N to N+2, where N is the number of triangles to be drawn. This allows for less use of disk space, as well as making them faster to load into RAM.

For example, the four triangles in the diagram, without using triangle strips, would have to be stored and interpreted as four separate triangles: ABC, CBD, CDE, and EDF. However, using a triangle strip, they can be stored simply as a sequence of vertices ABCDEF. This sequence would be decoded as a set of triangles ABC, BCD, CDE and DEF then every even-numbered (with counting starting from one) triangle would be reversed resulting in the original triangles.

OpenGL has built-in support for triangle strips. Fixed function OpenGL (deprecated in OpenGL 3.0) has support for triangle strips using immediate mode and the glBegin(), glVertex*(), and glEnd() functions. Newer versions support triangle strips using glDrawElements and glDrawArrays.

To draw a triangle strip using immediate mode OpenGL, glBegin() must be passed the argument GL_TRIANGLE_STRIP, which notifies OpenGL a triangle strip is about to be drawn. The glVertex*() family of functions specify the coordinates for each vertex in the triangle strip. For more information, consult The OpenGL Redbook.

To draw the triangle strip in the diagram using immediate mode OpenGL, the code is as follows:

Note that only one additional vertex is needed to draw the second triangle. In OpenGL, the order in which the vertices are specified is important so that surface normals are consistent.

Quoted directly from the OpenGL Programming Guide:

GL_TRIANGLE_STRIP

Draws a series of triangles (three-sided polygons) using vertices v0, v1, v2, then v2, v1, v3 (note the order), then v2, v3, v4, and so on. The ordering is to ensure that the triangles are all drawn with the same orientation so that the strip can correctly form part of a surface.

The above code sample and diagram demonstrate triangles drawn in a clockwise orientation. For those to be considered front-facing, a preceding call to glFrontFace(GL_CW) is necessary, which otherwise has an initial value of GL_CCW (meaning that triangles drawn counter-clockwise are front-facing by default). This is significant if glEnable(GL_CULL_FACE) and glCullFace(GL_BACK) are already active (GL_BACK by default), because back-facing triangles will be culled, so will not be drawn and will not appear on-screen at all.


...
Wikipedia

...