"OpenGL® camera" is the name given to the virtual position of a viewer within an Open Graphics Library® (OpenGL®) scene. It is defined by the position of the viewer within the scene, and then the location or direction in which the viewer is looking. The position of the camera in an OpenGL® scene will determine what portion of a scene will be rendered to the display device and at what angle. Two matrices are used to describe an OpenGL® camera: the modelview matrix and the projection matrix, which describe the camera’s position and the way the objects at which it is looking are rendered, respectively. A camera is able to be moved within a scene to show different areas, or to simulate motion, although in many instances it is easier or more efficient to move the objects in a scene instead of the camera.
When learning OpenGL®, some programmers have a difficult time understanding the relatively abstract properties of an OpenGL® camera. This is largely because some transformations and other functions do not operate in the same way on a camera as they would on a standard OpenGL® object. Additionally, complex operations with an OpenGL® camera usually require proficiency with matrix math and an understanding of the OpenGL® transformation pipeline. There are some convenience functions in supporting OpenGL® libraries, although it can be difficult to rely solely on the support toolkits in more interactive applications.
The position of an OpenGL® camera is defined using the modelview matrix. The camera can be positioned anywhere within a scene and translated or rotated along any axis. In many applications, most notably applications that contain only a handful of objects, it can be easier to apply inverse transformations to the objects within a scene to give the appearance of motion. In essence, the entire scene moves around a static camera in this case. For larger scenes, it can be easier to deal with the complexities of the pipeline and matrix math to move the camera freely, leaving the scene static.
The attributes of an OpenGL® camera are controlled by the projection matrix. To use the camera analogy, the projection matrix can be thought of as the type of lens being used. The projection matrix is frequently modified to make orthographic projections, which have no perspective adjustment, and perspective projections that do account for distance in determining the size of objects. Other effects, such as a fish-eye lens, focal length or different aspect ratios, can all be set through the use of the projection matrix.