Game Development Reference
In-Depth Information
field of view, image resolution, size of the photo that will be taken, and a unique position and
orientation within the world (relative to some origin). Even if both the objects and the camera are
moving, when you press the shutter release, you catch a still image of the scene (for now, we'll
neglect the shutter speed, which might cause a blurry image). For that infinitely small moment,
everything stands still and is well defined, and the picture reflects exactly all those configurations
of position, orientation, texture, materials, and lighting. Figure 7-1 shows an abstract scene with
a camera, light, and three objects with different materials.
Figure 7-1. An abstract scene
Each object has a position and orientation relative to the scene's origin. The camera, indicated
by the eye, also has a position in relation to the scene's origin. The pyramid in Figure 7-1 is
the so-called view volume or view frustum , which shows how much of the scene the camera
captures and how the camera is oriented. The little white ball with the rays is the light source in
the scene, which also has a position relative to the origin.
We can directly map this scene to OpenGL ES, but to do so we need to define the following:
ï?® Objects (a.k.a. models) : These are generally composed of four sets of
attributes: geometry, color, texture, and material. The geometry is specified
as a set of triangles. Each triangle is composed of three points in 3D space,
so we have x, y, and z coordinates defined relative to the coordinate system
origin, as shown in Figure 7-1 . Note that the z axis points toward us. The
color is usually specified as an RGB triple, which we are used to already.
Textures and materials are a little bit more involved. We'll get to those later on.
ï?® Lights : OpenGL ES offers a couple different light types with various
attributes. They are just mathematical objects with positions and/or
directions in 3D space, plus attributes such as color.
 
Search WWH ::




Custom Search