## Glossary

face culling

The ability to cull triangles based on the winding order of the triangle. This functionality is activated in OpenGL by using glEnable with GL_CULL_FACE. Which faces get culled is determined by the glCullFace and glFrontFace functions.

winding order

The order, clockwise or counter-clockwise, that the 3 vertices that make up a triangle are received in. This is measured in window coordinates, two-dimensionally.

projection

The act of taking a series of objects in a higher dimension and presenting those objects in a lower dimension. The act of rendering a 3D scene to a 2D image requires projecting that scene from three dimensions into two dimensions.

Projection always happens relative to a surface of projection. Projecting 2D space onto a 1D space requires a finite line to be projected on. Projecting 3D space onto 2D space requires a plane of projection. This surface is defined in the higher dimension's world.

orthographic projection

A form of projection that simply negates all offsets in the direction perpendicular to the surface of projection. When doing a 3D-to-2D orthographic projection, if the plane is axis-aligned, then the projection can be done simply. The coordinate that is perpendicular to the plane of projection is simply discarded. If the plane is not axis-aligned, then the math is more complex, but it has the same effect.

Orthographic projections are uniform in the direction of the projection. Because of the uniformity, lines that are parallel in the higher dimensional space are guaranteed to remain parallel in the lower dimensional space.

perspective projection

A form of projection that projects onto the surface based on a position, the eye position. Perspective projections attempt to emulate a pin-hole camera model, which is similar to how human eyes see. The positions of objects in space are projected onto the surface of projection radially, based on the eye position.

Parallel lines in the higher dimension are not guaranteed to remain parallel in the lower dimension. They might, but they might not.

frustum

Geometrically, a frustum is 3D shape; a pyramid that has the top chopped off. The view of a 3D-to-2D perspective projection, from the eye through the plane of projection, has the shape of a frustum.

perspective divide

A new name for the transformation from clip space to normalized device coordinate space. This is so called because the division by W is what allows perspective projection to work using only matrix math; a matrix alone would not otherwise be able to perform the full perspective projection operation.

camera space

An arbitrarily defined, but highly useful, space from which the perspective projection can be performed relatively easily. Camera space is an infinitely large space, with positive X going right, positive Y going up, and positive Z coming towards the viewer.

In camera space, the eye position of the perspective projection is assumed to be at (0, 0, 1), and the plane of projection is a [-1, 1] plane in X and Y, which passes through the 3D origin. Thus, all points that have a positive Z are considered to be behind the camera and thus out of view. Positions in camera space are defined relative to the camera's location, since the camera has a fixed point of origin.

camera zNear, camera zFar

Normalized device coordinate (NDC) space is bounded in all dimensions on the range [-1, 1]. Camera space is unbounded, but the perspective transform implicitly bounds what is considered in view to [-1, 1] in the X and Y axis. This leaves the Z axis unbounded, which NDC space does not allow.

The camera zNear and zFar values are numbers that define the minimum and maximum extent of Z in the perspective projection transform. These values are positive, though they represent negative values in camera space. Using the standard perspective transform, both values must be greater than 0, and zNear must be less than zFar.

swizzle selection

Swizzle selection is a vector technique, unique to shading languages, that allows you to take a vector and arbitrarily build other vectors from the components. This selection is completely arbitrary; you can build a vec4 from a vec2, or any other combination you wish, up to 4 elements.

Swizzle selections use combinations of x, y, z, and w to pick components out of the input vector. Swizzle operations look like this:

vec2 firstVec;
vec4 secondVec = firstVec.xyxx;
vec3 thirdVec = secondVec.wzy;

Swizzle selection is, in graphics hardware, considered an operation so fast as to be instantaneous. That is, graphics hardware is built with swizzle selection in mind.

matrix

A two-dimensional arrangement of numbers. Like vectors, matrices can be considered a single element. Matrices are often used to represent the coefficients in a system of linear equations; because of this (among other things), matrix math is often called linear algebra.

The size of a matrix, the number of columns and rows (denoted as NxM, where N is the number of columns and M is the number of rows) determines the kind of matrix. Matrix arithmetic has specific requirements on the two matrices involved, depending on the arithmetic operation. Multiplying two matrices together can only be performed if the number of rows in the matrix on the left is equal to the number of columns in the matrix on the right. For this reason, among others, matrix multiplication is not commutative (A*B is not B*A; sometimes B*A is not even possible).

4x4 matrices are used in computer graphics to transform 3 or 4-dimensional vectors from one space to another. Most kinds of linear transforms can be represented with 4x4 matrices.

column-major, row-major

These terms define the two ways in which a matrix can be stored as an array of values. Column-major order means that, for an NxM matrix (columns x rows), the first N values in the array are the first column (top-to-bottom), the next N values are the second column, and so forth. In row-major order, the first M values in the array are the first row (left-to-right), followed by another M values for the second row, and so forth.

Fork me on GitHub