Learn something new every day
More Info... by email
An OpenGL® triangle is the most basic shape that can be formed in OpenGL® and have a surface. In geometry, a triangle is a shape that is made from three points, each joined by a line. In OpenGL®, each point that forms a corner of the triangle is known as a vertex, which is a collection of coordinates in three-dimensional (3D) space. A triangle is the most basic shape with a surface, meaning it also is the base unit used to create all larger shapes within a given scene. An advantage in using an OpenGL® triangle over other polygons is the support provided for more complex structures such as triangle strips, triangle fans and triangle meshes.
One of the purposes of the OpenGL® library is to provide mechanisms for displaying and animating complex 3D objects by utilizing all available hardware, including graphics cards and graphics processing units (GPUs). Triangles are so widely used in 3D graphics that most graphics cards are optimized to render triangles faster than most other polygons. An object formed in OpenGL® takes advantage of this feature by converting large and complex objects into a sequence of triangles. A commonly used shaped, called a quad or quadrilateral, is a simple rectangle, but it is made of two triangles that share a single edge. It is faster to render the two triangles than to perform the calculations necessary to render a rectangle.
Although it can be conceptually simple to use an OpenGL® triangle sequence to construct a larger object, the library provides functions that can make the task easier and faster and potentially use less space. The most common is called a triangle strip. This is a shape that begins with a single OpenGL® triangle and allows the user to define another point that, when connected to the previous two points, forms another connected triangle. The process of defining points can continue, adding a new triangle each time by defining only one additional point, ultimately forming a long strip of triangles that alternate in facing as they progress.
A strip can be used to form another complex OpenGL® triangle shape known as a triangle mesh. This can be visualized as a sequence of triangle strips lined up one on top of the other. The result resembles a grid, except that each square actually consists of two triangles. In 3D space, a triangle mesh can be used to form non-uniform surfaces, such as that of a human face or a mountain range.
Finally, an OpenGL® triangle also can be used to form a shape known as a triangle fan. A triangle fan begins with a single triangle. A fourth vertex is defined, and it is connected to the previous triangle, forming a new triangle. The difference from a triangle strip is that, not only does each of the triangles share a side with the previous one, but each also shares a single common endpoint from which they all appear to emanate. In a 3D space, a triangle fan can be used to create other shapes, such as a cone or pyramid.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!