UW Graphics Group

CS 559: Computer Graphics
Fall 2001

CS 559 Home
Calendar Resources Assignments Projects 1 2 3  

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.

 

UW Graphics Group

CS559 Web

     
Home Resources Assignments Tools  
Calendar Policies Projects 1 2 3   Examples
Copyright (C) 2001 by Michael Gleicher
Last modified: 19:10 Nov 15, 2001