Category: 

What Is an OpenGL® Camera?

Article Details
  • Written By: Eugene P.
  • Edited By: Angela B.
  • Last Modified Date: 03 September 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
In late 19th-century London, mail was delivered to residential addresses up to twelve times each day.   more...

September 28 ,  1924 :  Two US military planes complete the first flights around the world.  more...

"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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

exception 'Exception' with message 'error writing captcha: Duplicate entry '2147483647' for key 'PRIMARY'' in /ssd/www/wisegeek/public_html/_core/classes/public/Captcha.php:44
Stack trace:
#0 /ssd/www/wisegeek/public_html/_core/controls/public/ControlDiscussionPostBox.php(324): Captcha->createCaptcha()
#1 /ssd/www/wisegeek/public_html/framework/classes/Control.php(104): ControlDiscussionPostBox->preRender(false)
#2 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): Control->render()
#3 /ssd/www/wisegeek/public_html/tpl/default-nocustom-lu/pages/public/article/article.htm(526): Control->__toString()
#4 /ssd/www/wisegeek/public_html/framework/classes/Control.php(300): require('/ssd/www/wisege...')
#5 /ssd/www/wisegeek/public_html/framework/classes/Control.php(309): Control->requireTpl('pages/public/ar...', Object(PageArticleCom), true)
#6 /ssd/www/wisegeek/public_html/framework/classes/Control.php(131): Control->renderTpl('pages/public/ar...', Object(PageArticleCom))
#7 /ssd/www/wisegeek/public_html/framework/classes/FormDataControl.php(87): Control->renderTemplate()
#8 /ssd/www/wisegeek/public_html/framework/classes/Control.php(109): FormDataControl->renderTemplate()
#9 /ssd/www/wisegeek/public_html/framework/classes/ScriptPage.php(50): Control->render(false)
#10 /ssd/www/wisegeek/public_html/framework/classes/Control.php(149): ScriptPage->render()
#11 /ssd/www/wisegeek/public_html/framework/classes/Page.php(97): Control->__toString()
#12 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(443): Page->processRequest()
#13 /ssd/www/wisegeek/public_html/_core/classes/public/PublicFrontController.php(7): PublicFrontController->renderPage()
#14 /ssd/www/wisegeek/public_html/index.php(11): PublicFrontController::run()
#15 {main}