Category: 

What Is an OpenGL® Triangle?

Article Details
  • Written By: Eugene P.
  • Edited By: Angela B.
  • Last Modified Date: 11 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
The atmosphere of Jupiter's moon Io collapses every time it is eclipsed by the planet.   more...

September 29 ,  2008 :  The Dow Jones Industrial Average experienced its largest one-day drop in history.  more...

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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}