Game Development Reference
In-Depth Information
6 Texture mapping
Since we are exploring real-time animation we are limited in the number
of polygons we can draw in a scene fast enough to provide the illusion of
movement. Computers and graphics cards get faster and so this limit
rises steadily. Most computers on the market will cope easily with 5000
polygons, 50 times per second. Nevertheless, if you have three
characters and a set then 5000 is a difficult limit to work with, rarely
allowing more than 1500 polygons per character. Just to model a
convincing face will usually take at least 3000 polygons. So how do we
work around this limitation. The answer is texture mapping. By applying a
carefully produced bitmap to the polygons we can add the illusion of
considerably more detail. Figure 6.1 shows how the same mesh looks
when drawn as a wireframe, as a smooth shaded mesh and as a textured
mesh. The textured mesh looks much more convincing. To see the mesh
moving check out 'Examples\Chapter06\Dancer.html'. Right click and
choose 'smooth shaded' to view the same animation without textures and
'wireframe' to view the animation in wireframe format. In this chapter we
are going to look at how to load the bitmaps into memory, how to copy this
pixel data to OpenGL in a format it will understand and how to map these
bitmaps onto the polygons in the mesh.
Loading a windows bitmap
There are many types of bitmap file; in the desktop publishing arena the
Tiff (Tagged Image File Format) is amongst the most common. On the
Internet, Jpeg (Joint Photographic Experts Group) and Gif (Compuserve
format) are used most because of the compression inherent in the
formats. Computer graphics experts often use Tga (Targa) files. But on
the Windows platform the most ubiquitous bitmap format is a 'bmp' file.
These files are sometimes called 'Dibs' (Device Independent Bitmaps) by
computer buffs. Bitmap files all provide a way of storing an array of pixel
Search Nedrilad ::




Custom Search