Texture Mapping

Tom Kelliher, CS 320

Apr. 30, 2003

Administrivia

Announcements

Assignment

Work on project.

From Last Time

Light lab II.

Outline

  1. Introduction to texture mapping.

  2. A few issues/problems.

  3. Example program: checker.c

Coming Up

Texture lab.

Introduction

  1. What is a texture?

  2. Why texture map? Complexity from simplicity.

  3. Where can I get textures? Fixed patterns (polygon fills), texture generation functions, digitized images.

  4. Do Web browsers texture map?

  5. 1-D and 2-D textures.

A Little More Detail

  1. Texture pattern: . Stored in texture memory as array of texels. (Texture memory and the rise of AGP.)

  2. Texture mapping: mapping from T to object's geometric coordinates. (Must then map to screen coordinates.)

  3. Possible problems: curved surfaces, closed surfaces, pixels not inverse mapping onto texels, aliasing.

  4. How is a texture mapped to an object?
    1. texture and vertex coordinates.

    2. Range of texture coordinates.

    3. Wrapping modes: repeat, clamp.

  5. How is it applied to an object?
    1. Modulation, decal.

  6. Magnification and minification. Filters.

checker.c

Numbers in parentheses refer to line numbers in handouts.

  1. Generation of a texture: makeCheckImage() (24).

    Interpretation?

  2. Initializing: init() (39).
    1. Storage formats, texture handles and binding.

    2. Wrapping modes.

    3. Minification, magnification filters.

    4. glTexImage2D() --- ugh.

  3. Rendering: display() (73).
    1. Enabling textures and specifying mapping mode.

    2. Specifying which texture.

    3. Binding texture and vertex coordinates.

  4. Comparison of code with rendered results.

Experiments:

  1. Is the lower right result a fluke? Rotate the lower left polygon and see what happens.

  2. Specify a color for the polygons. Did anything change? Change the mode from GL_DECAL to GL_MODULATE and try again.

  3. Individually change the GL_REPEATs to GL_CLAMPs and see what happens.

Brief demos of other programs, time permitting.



Thomas P. Kelliher
Tue Apr 29 15:30:37 EDT 2003
Tom Kelliher