This computer graphics design and computer aided design site aims to provide book reviews and free ebook on 3d computer graphics, opengl tutorial, opengl 3d, 3d design, vrml examples, vrml tutorials, xlib tutorial, adobe photoshop tutorial, illustrator, dreamweaver
and coreldraw tutorial.

OpenGL Texture Mapping - Sample Chapter

After reading this chapter, you’ll be able to do the following:
  • Understand what texture mapping can add to your scene
  • Specify texture images in compressed and uncompressed formats
  • Control how a texture image is filtered as it is applied to a fragment
  • Create and manage texture images in texture objects and, if available, control a high-performance working set of those texture objects
  • Specify how the color values in the image combine with those of the fragment to which it’s being applied
  • Supply texture coordinates to indicate how the texture image should be aligned with the objects in your scene
  • Generate texture coordinates automatically to produce effects such as contour maps and environment maps
  • Perform complex texture operations in a single pass with multitexturing (sequential texture units)
  • Use texture combiner functions to mathematically operate on texture, fragment, and constant color values
  • After texturing, process fragments with secondary colors
  • Perform transformations on texture coordinates using the texture matrix
  • Render shadowed objects, using depth textures


So far, every geometric primitive has been drawn as either a solid color or smoothly shaded between the colors at its vertices—that is, they’ve been drawn without texture mapping. If you want to draw a large brick wall without texture mapping, for example, each brick must be drawn as a separate polygon. Without texturing, a large flat wall—which is really a single rectangle—might require thousands of individual bricks, and even then the bricks may appear too smooth and regular to be realistic.

Texture mapping allows you to glue an image of a brick wall (obtained, perhaps, by scanning in a photograph of a real wall) to a polygon and to draw the entire wall as a single polygon. Texture mapping ensures that all the right things happen as the polygon is transformed and rendered. For example, when the wall is viewed in perspective, the bricks may appear smaller as the wall gets farther from the viewpoint. Other uses for texture mapping include depicting vegetation on large polygons representing the ground in flight simulation; wallpaper patterns; and textures that make polygons look like natural substances such as marble, wood, and cloth. The possibilities are endless. Although it’s most natural to think of applying textures to polygons, textures can be applied to all primitives—points, lines, polygons, bitmaps, and images. Plates 6, 8, 18–21, and 24–32 all demonstrate the use of textures.

Click to Download

Followers