OpenGL polygons are objects with more than two vertices. Triangles are the simplest and most optimized type. Tessellation subdivides shapes into triangles, except for simple polygons which follow specific rules. Complex polygons can be created in 3D modeling programs or procedurally. Each polygon has a face and a normal, used to define surface direction and texture effects.
An Open Graphics Library® (OpenGL®) polygon is any object made in OpenGL® that consists of more than two vertices. Basically, any object that isn’t a point or line is considered a polygon. OpenGL®, as well as most graphics cards, usually have special optimizations to handle mostly 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 cases, quadrilaterals, or four-sided polygons, can be handled by OpenGL®, mainly in two-dimensional (2D) drawing mode. With the exception of a simple convex OpenGL® polygon, most shapes with more than three vertices will eventually be subdivided into triangles through a process called tessellation, which can have dramatic undesirable effects on a scene.
The only type of OpenGL® polygon that can be drawn natively without the need for tessellation is known as a simple polygon. This type of shape follows some very simple rules. The sides must be convex, meaning they do not create vertex angles less than 90°. No edge can cross and only two lines can meet at any given vertex. This limits a simple polygon to a self-contained 2D shape such as a square or octagon because, if it were three-dimensional (3D), more than two lines would meet at some vertices.
When constructing a very complex OpenGL® polygon, it is often easier to create the object in an external 3D modeling program. Not only does this allow for a more comfortable visual environment in which to build an object, but it has the added benefit of giving the designer control over how shapes are tessellated so they don’t cause problems when rendered. Alternatively, a polygon can be created procedurally by algorithms that draw vertices according to a model, as can be done to create a helix or spiral model.
Every OpenGL® polygon has a face, the solid area within the lines of the shape. While you can change this behavior, in general each polygon is only visible when its face is facing the viewing camera. If a polygon is facing the wrong direction, it may become invisible, depending on how it is rendered.
Each OpenGL® polygon also has a value known as normal. The normal is used to define the direction in which the surface of the polygon faces. Even if the polygon is clearly at a certain angle and in a certain location, the surface normal can help create special texture effects or mimic non-uniform physical properties. A normal for an OpenGL® polygon can be set to any value, even negative values, although the results may be unpredictable.
Protect your devices with Threat Protection by NordVPN