Understanding the Camera and Coordinates

As you draw in 3D space, you ultimately must project the 3D view onto a 2D screen—similar to capturing a 3D scene using a camera in the real world. This symbolism is formally recognized in OpenGL, so many concepts in OpenGL are explained in terms of a camera.

As you will see in this subsection, the part of your drawing that becomes visible depends on the location of the camera, the direction of the camera lens, the orientation of the camera (such as upside down), the zoom level, and the size of the capturing "film."

These aspects of projecting a 3D picture onto a 2D screen are controlled by three methods in OpenGL:

• gluLookAt: Controls the direction of the camera

• glFrustum: Controls the viewing volume or zoom

• glViewport: Controls the size of the screen or the size of the camera's "film"

You won't be able to program anything in OpenGL unless you understand the implications of these three APIs. Let us elaborate on the camera symbolism further to explain how these three APIs affect what you see on an OpenGL screen. We will start with gluLookAt.

0 0

Post a comment