Understanding 3D Graphics

The world is three-dimensional, yet we routinely view it in two dimensions. When you watch television or look at a picture in a book, the 3D images are flattened out, or projected, onto a 2D surface (the TV panel or book page).

Try this simple experiment: cover one eye and look out the window. What do you see? Light from the sun bounces off objects outside, passes through the window, and travels to your eye so you can perceive it. In graphics terms, the scene outside is projected onto the window (or viewport). If someone replaced your window with a high-quality photograph, it would look the same until you moved.

Based on how close your eye is to the window and how big the window is, you can see a limited amount of the world outside. This is called your field of view. If you draw a line from your eye to the four corners of the window and beyond, you would get the pyramid in Figure 10.1, on the next page. This is called the view frustum (Latin for a "piece broken off"). For performance reasons, the frustum is usually bounded by near and far clipping planes as well. You can see everything inside the frustum but nothing outside of it.

Figure 10.1: Viewing a three-dimensional scene

In 3D computer graphics, your computer screen acts as the viewport. Your job is to fool the user into thinking it's a window into another world just on the other side of the glass. The OpenGL graphics library is the API you use to accomplish that.

0 0

Post a comment