org.proteinshader.graphics.textures
Class TextureManager

java.lang.Object
  extended by org.proteinshader.graphics.textures.TextureManager

public class TextureManager
extends Object

Uses a TextureFactory object to read textures from files and then stores Java Texture objects that have references to OpenGL texture objects and menu names that can be used for selecting the textures.

Whenever the readTextureFiles(gl) method is called, it will free any graphics card memory for previously loaded textures before asking the TextureFactory to create Textures from the files specified in the textures config file.

The list returned by the getTextures() method will always have at least one Texture object in it, the Texture with the menu name of "None".


Constructor Summary
TextureManager()
          Constructs a TextureManager.
 
Method Summary
 void deleteTextures(GL gl)
          Frees graphics card memory for all previously cached textures.
 Vector<Texture> getBendTextures()
          Returns a list of Java Texture objects with information on OpenGL texture objects that are currently stored on the graphics card.
 Vector<Texture> getHalftoningTextures()
          Returns a list of Java Texture objects with information on OpenGL texture objects that are currently stored on the graphics card.
 Vector<Texture> getPatternsTextures()
          Returns a list of Java Texture objects with information on OpenGL texture objects that are currently stored on the graphics card.
 void readTextureFiles(GL gl)
          Calls on the TextureFactory to read the texture files specified in the texture config file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextureManager

public TextureManager()
Constructs a TextureManager.

Method Detail

readTextureFiles

public void readTextureFiles(GL gl)
                      throws TextureException
Calls on the TextureFactory to read the texture files specified in the texture config file.

The TextureFactory will always add a first Texture object with the menu name "None" and the OpenGL texture name (an integer) of zero. The factory will read in as many of the texture files as can be read and save information on any errors. After the list of all readable textures has been saved, this method will check for any errors, and, if any are found, will throw a TextureException.

Parameters:
gl - the current GL object.
Throws:
TextureException

getPatternsTextures

public Vector<Texture> getPatternsTextures()
Returns a list of Java Texture objects with information on OpenGL texture objects that are currently stored on the graphics card.

Each Texture object holds the name (an integer) of an OpenGL texture object, as well as a String name suitble for use in a menu. The list will always start with a Texture with the menu name of "None" and an OpenGL name (an integer) of zero.

Returns:
The Texture objects that were created with the readTextureFiles() method.

getHalftoningTextures

public Vector<Texture> getHalftoningTextures()
Returns a list of Java Texture objects with information on OpenGL texture objects that are currently stored on the graphics card.

Each Texture object holds the name (an integer) of an OpenGL texture object, as well as a String name suitble for use in a menu. The list will always start with a Texture with the menu name of "None" and an OpenGL name (an integer) of zero.

Returns:
The Texture objects that were created with the readTextureFiles() method.

getBendTextures

public Vector<Texture> getBendTextures()
Returns a list of Java Texture objects with information on OpenGL texture objects that are currently stored on the graphics card.

Each Texture object holds the name (an integer) of an OpenGL texture object, as well as a String name suitble for use in a menu. The list will always start with a Texture with the menu name of "None" and an OpenGL name (an integer) of zero.

Returns:
The bend Texture objects that were created with the readTextureFiles() method.

deleteTextures

public void deleteTextures(GL gl)
Frees graphics card memory for all previously cached textures.

Parameters:
gl - the current GL object.


Copyright © 2007-2008