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:
- The texture map is rectangular, but
the surface patch need not be.
- One texel may may to several whole or partial pixels.
- Several texels may partially or fully contribute
to a single pixel.
- The texture map may only cover part of
the surface patch -- how do we extend it to the
entire patch?
- Only part of the texture map may
cover the surface patch -- how do we specify
such partial coverage?
-
-
MAIN STEPS IN TEXTURE MAPPING
- Construct the texture map.
--
This can be scanned in or computed.
- 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.
- Enable texture mapping.
--
E.g., glEnable(GL_TEXTURE_2D);
- Draw the surfaces, supplying
texture coordinates to vertices.
--
The main function is
glTexCoord*( )
-
-
MAIN COMMAND FOR REGISTERING A TEXTURE MAP:
-
-
THE PARAMETERS FOR glTexImage2D:
-
The target should
be the constant GL_TEXTURE_2D in current
implementations.
-
The level generally be 0 (unless you
do mipmapping, an
advanced topic).
-
The components is typically 3 or 4
(and are explained in
)
-
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.
-
The format and type
parameters have the same meaning as in
glReadPixels( ).
-
Finally, texmap points to the actual
texture map, including its border.
-
-
MODULATING AND BLENDING
--
The main function here is
-
-
A simple illustration of textures.