TEXTURE MAPS

WHAT ARE TEXTURE MAPS?
-- As data, they can be thought of as pixmaps.
-- Here is checker pattern texture map
-- So what characterizes this pixmap as "textures" is how they are used.
-- How do we use texture maps? Basically, we paint it onto a surface!
SOME ISSUES
Let T(s,t) be a typical 2-dimensional texture map. It is mapped to the surface of a geometric object, which are now subject to the usual transformations, and finally projected onto the screen.
-- Several complications arise:
  1. The texture map is rectangular, but the surface patch need not be.
  2. One texel may may to several whole or partial pixels.
  3. Several texels may partially or fully contribute to a single pixel.
  4. The texture map may only cover part of the surface patch -- how do we extend it to the entire patch?
  5. Only part of the texture map may cover the surface patch -- how do we specify such partial coverage?
MAIN STEPS IN TEXTURE MAPPING
  1. Construct the texture map.
    -- This can be scanned in or computed.
  2. Specify how to apply the texture map to a surface patch.
    -- The main command here is glTexImage2D( ).
    -- There may be preliminary setup commands such as glPixelStore*( ) to be called.
  3. Enable texture mapping.
    -- E.g., glEnable(GL_TEXTURE_2D);
  4. Draw the surfaces, supplying texture coordinates to vertices.
    -- The main function is glTexCoord*( )
MAIN COMMAND FOR REGISTERING A TEXTURE MAP:
void glTexImage2D(
    GLenum target,
    GLint level,
    GLint components,
    GLsizei width,
    GLsizei height,
    GLint border,
    GLenum format,
    GLenum type,
    const GLvoid * texmap);
THE PARAMETERS FOR glTexImage2D:
  1. The target should be the constant GL_TEXTURE_2D in current implementations.
  2. The level generally be 0 (unless you do mipmapping, an advanced topic).
  3. The components is typically 3 or 4 (and are explained in )
  4. The height and width the texture is the size of the rectangular map. The border is the width of the map, usually 0.
    -- The height and width must have the form 2^m + 2b where b is the border.
  5. The format and type parameters have the same meaning as in glReadPixels( ).
  6. Finally, texmap points to the actual texture map, including its border.
MODULATING AND BLENDING
-- The main function here is
glTexEnvf()
A simple illustration of textures.