An Open Graphics Library® (OpenGL®) polygon is any object that is made in OpenGL® that consists of more than two vertices. Essentially, any object that is not a point or a line is considered a polygon. OpenGL®, as well as most graphics cards, usually have special optimizations to deal primarily with triangles, or three-sided polygons, because triangles are the simplest type of polygon that can be made with the fewest vertices and sides. In some instances, quadrilaterals, or four-sided polygons, can be handled by OpenGL®, mainly in two-dimensional (2D) drawing modes. With the exception of a convex, simple OpenGL® polygon, most shapes with more than three vertices will eventually be broken down into triangles through a process called tessellation, which can have dramatic undesired effects on a scene.
The only type of OpenGL® polygon that can be drawn natively without the need for tessellation is known as a simply polygon. This type of shape follows some very simple rules. The sides must be convex, meaning they do not create angles at the vertices of less than 90°. No edges can cross each other, and any only two lines can meet at any given vertex. This limits a simple polygon to a 2D self-contained shape such as a square or an octagon because, if it were three-dimensional (3D), then more than two lines would meet at some vertices.
When constructing a very complex OpenGL® polygon, it often is easier to create the object in an external 3D modeling program. This not only allows for a more convenient, visual environment in which to build an object, but has the added benefit of providing the designer control over how shapes are tessellated so they do not cause problems when rendered. Alternately, a polygon can be created procedurally through algorithms that plot the vertices according to a pattern, as can be done to create a helix or spiral pattern.
Each OpenGL® polygon has a face, the solid area inside the lines of the shape. Although it is possible to change this behavior, in general each polygon is only visible when its face is pointing toward the viewing camera. If a polygon is facing the wrong way, then it might become invisible, depending on the rendering mode.
Every OpenGL® polygon also has a value known as a normal. The normal is used to define the direction the surface of the polygon is facing. Even though the polygon is clearly at a certain angle and at a certain position, the surface normal can help to create special texture effects or mimic physical properties that are not uniform. A normal for an OpenGL® polygon can be set to any value, even negative values, though the results might be unpredictable.