# What Are OpenGL® Coordinates?

OpenGL® coordinates are numerical values that indicate specific positions within a virtual, three-dimensional (3D) space. These values are individual points similar to those plotted on a graph in mathematical activities in arithmetic and algebra. Using this type of system, coordinates can be identified by three different values that indicate the position of that particular point in each of three directions. OpenGL® coordinates are usually indicated along a “Y-axis,” which is an up or down position; the “X-axis” that dictates the position of a point to the left or right of middle; and a “Z-axis” that indicates how close or far from a viewer the point is located.

The system used to designate the position for OpenGL® coordinates is quite similar to the one used to graph equations and values in mathematics. While those systems typically have two directions and values, an “X” and “Y” value, the system used in OpenGL® has a third value to determine where an object is in 3D space. These are used by a programmer to assign particular OpenGL® coordinates to different points, which can then be used to create objects in the program.

One simple way for someone to envision the use of OpenGL® coordinates is to consider a basic graph used in mathematics. This type of system has a horizontal line and a vertical line, or an X-axis and a Y-axis. A point at the intersection between these two is typically indicated by the coordinate (0, 0) with the first number representing the X-axis and the second indicating position on the Y-axis.

OpenGL® coordinates use a similar system and allow someone creating objects in the program to assign values to distances along those axes. Numerical values are then used to indicate the distance of a point from that central intersection of (0, 0). Negative values indicate left or down on the axes, while positive values represent positions to the right or up from the intersection. This means that a point at (1, 1) is one unit to the right of the central point and one unit up from it.

In addition to these two axes, OpenGL® coordinates also use a Z-axis, which represents the third dimension of space. Basically, this value controls how close or far a point is from the viewing position of the invisible camera within the space. This camera represents a viewer if he or she was within the virtual environment created using OpenGL®. A positive value on the Z-axis indicates an object that is closer to the camera than the intersection point, while a negative number is used for points that are further away.

The entire system of OpenGL® coordinates allows someone to indicate the precise location of a point within the virtual 3D space. Someone can, therefore, indicate one point at (1, 2, 3), which is an object one unit to the right, two units up, and three units toward a viewer from the central point. A second point can be created at (-1, 2, -1) that would be one unit to the left, two units up, and one unit away from the viewer from the central point. These two points can then be connected by a line that can exist within the 3D environment, with additional points and lines creating more complex shapes.

## Discuss this Article

## Post your comments