CS559
Fall 2005

News
Calendar
Assignments

Lectures/Notes
Tutorials
Sample Code

Project 1
Project 2
Project 3

Basic Info
Policies

C++ hints


Some hints for using Texture Maps

The basic concepts of texture mapping are easy. What is tricky is remembering all the little gotchas of using texturing in GL. Once everything is set up correctly, all is easy. However, ...

To help you get through this maze of little gotchas, I have provided a "Texture Manager" that can help you with much of the aspects of loading and building textures, finding texture objects, ... It allows you to refer to textures by name, and will load them from a TGA file as needed. There is a primitive mechanism provided for searching a list of directories - you should use this to make sure your program will run both in the CSL lab, and on any other machine you might want to hack on.

Some texture gotchas - things that often go wrong and cause your textures not to appear (whether or not you use my code):

  • Remember that textures must be of certain sizes (multiples of 16)
  • If you are using textures to modulate material properties (which you need to if you are going to see lighting on the textured surface) don't forget to make the surface a light color since the texture only darkens the existing color.
  • Don't forget to turn texturing on in the beginning.
  • Don't forget to use texture coordinates on your vertices.
  • Remember that OpenGL commands do not work in an FlTk program UNLESS you are either in a draw routine, or have done a "make_current." Look this up in the FlTk manual if you have questions.
  • Don't forget to turn off textures (bind to texture 0) when you're done using a texture.

Many of the things that the OpenGL book programs do are optional. Often, you can use the defaults for things like filtering.

Project Source Code