Game Development Reference
In-Depth Information
The rest of the class is the same as in the previous version. The only difference in usage is
how we call the constructor. Since this is perfectly simple, we won't write an example just for
mipmapping. We'll use mipmapping on all of our textures that we used for 3D objects. In
2D, mipmapping is less useful. A few final notes on mipmapping:
ï?®
Mipmapping can increase performance quite a bit if the objects you draw
using a mipmapped texture are small. The reason for this is that the GPU
has to fetch fewer texels from smaller images in the mipmap pyramid. It's
therefore wise to use mipmapped textures always on objects that might
get small.
ï?®
A mipmapped texture takes up 33 percent more memory compared to an
equivalent non-mipmapped version. This trade-off is usually fine.
ï?®
Mipmapping works only with square textures in OpenGL ES 1.x. This
is crucial to remember. If your objects stay white even though they are
textured with a nice image, you can be pretty sure that you forgot about
this limitation.
Note Once again, because this is really important, remember that mipmapping will only work
with square textures! A 512×256 pixel image will not work.
Simple Cameras
In the previous chapter, we talked about two ways to create a camera. The first one, the Euler
camera, is similar to what is used in first-person shooters. The second one, the look-at camera,
is used for cinematic camera work or for following an object. Let's create two helper classes to
create cameras that we can use in our games.
The First-Person or Euler Camera
The first-person or Euler camera is defined by the following attributes:
ï?®
The field of view in degrees.
ï?®
The viewport aspect ratio.
ï?®
The near and far clipping planes.
ï?®
A position in 3D space.
ï?®
An angle around the y axis (yaw).
ï?®
An angle around the x axis (pitch). This is limited to the range -90 to +90
degrees. Think how far you can tilt your own head and try to go beyond
those angles! We are not responsible for any injuries.
The first three attributes are used to define the perspective projection matrix. We did this already
with calls to gluPerspective() in all of our 3D examples.
 
 
Search WWH ::




Custom Search