gizmoball.graphics
Class TextureHandler

java.lang.Object
  extended by gizmoball.graphics.TextureHandler

public class TextureHandler
extends java.lang.Object

A class to handle using OpenGL textures. It can use textures from files, or create textures from colors. The textures are applied to the current OpenGL context. It caches textures, so changing files around while the program is running will not update the textures. Using more than one TextureHandler at once can lead to bad results. It does not have any observable state.


Constructor Summary
TextureHandler(java.lang.String textureDirectory)
          Creates a new TextureHandler, that looks in the specified directory for textures.
 
Method Summary
 void useColor(java.awt.Color c)
          Applies a texture, based on the given color.
 void useTexture(java.lang.String name)
          Applies a texture, that is based on the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextureHandler

public TextureHandler(java.lang.String textureDirectory)
Creates a new TextureHandler, that looks in the specified directory for textures.

Method Detail

useTexture

public void useTexture(java.lang.String name)
Applies a texture, that is based on the file. If the texture has already been loaded, does not load it again. If it could not load the file, keeps the previous texture (and does not throw an exception).


useColor

public void useColor(java.awt.Color c)
Applies a texture, based on the given color.