org.proteinshader.graphics.textures
Class TextureFactory

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

public class TextureFactory
extends Object

Reads texture files and creates OpenGL texture objects that can be used for real-time halftoning.

The texture files to be read must be named in a configuration file, textures.conf. A menu name should also be specified for each texture. The filenames should be listed one per line in the config file, followed by the equals sign and then the menu name. Here is an example:

hbars.png=Horizontal Bars
vbars.png=Vertical Bars
hash.png=Hash
noise.png=Noise


Field Summary
static String BEND_CONFIG
          Stores the name of the halftoning configuration file, which is currently set to 'halftoning_textures.conf'.
static String BEND_DIRECTORY
          Stores the relative pathname of the halftoning textures directory.
static String HALFTONING_CONFIG
          Stores the name of the halftoning configuration file, which is currently set to 'halftoning_textures.conf'.
static String HALFTONING_DIRECTORY
          Stores the relative pathname of the halftoning textures directory.
static String PATTERNS_CONFIG
          Stores the name of the patterns configuration file, which is currently set to 'patterns_textures.conf'.
static String PATTERNS_DIRECTORY
          Stores the relative pathname of the patterns textures directory.
 
Constructor Summary
TextureFactory()
          Constructs a TextureFactory.
 
Method Summary
 Vector<Texture> createBendTextures(GL gl)
          Creates Texture objects based on files named in BEND_CONFIG.
 Vector<Texture> createHalftoningTextures(GL gl)
          Creates Texture objects based on files named in HALFTONING_CONFIG.
 Vector<Texture> createPatternsTextures(GL gl)
          Creates Texture objects based on files named in PATTERNS_CONFIG.
 Vector<Texture> createTextures(GL gl, String directory, String configName)
          Creates Texture objects based on files named in the CONFIG_FILE.
 List<TextureException> getErrors()
          Returns a list with any exceptions that occurred the last time that createTextures() was called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERNS_DIRECTORY

public static final String PATTERNS_DIRECTORY
Stores the relative pathname of the patterns textures directory. The path is currently set to './../textures/patterns/'.

See Also:
Constant Field Values

PATTERNS_CONFIG

public static final String PATTERNS_CONFIG
Stores the name of the patterns configuration file, which is currently set to 'patterns_textures.conf'.

See Also:
Constant Field Values

HALFTONING_DIRECTORY

public static final String HALFTONING_DIRECTORY
Stores the relative pathname of the halftoning textures directory. The path is currently set to './../textures/halftoning/'.

See Also:
Constant Field Values

HALFTONING_CONFIG

public static final String HALFTONING_CONFIG
Stores the name of the halftoning configuration file, which is currently set to 'halftoning_textures.conf'.

See Also:
Constant Field Values

BEND_DIRECTORY

public static final String BEND_DIRECTORY
Stores the relative pathname of the halftoning textures directory. The path is currently set to './../textures/halftoning/'.

See Also:
Constant Field Values

BEND_CONFIG

public static final String BEND_CONFIG
Stores the name of the halftoning configuration file, which is currently set to 'halftoning_textures.conf'.

See Also:
Constant Field Values
Constructor Detail

TextureFactory

public TextureFactory()
Constructs a TextureFactory.

Method Detail

createPatternsTextures

public Vector<Texture> createPatternsTextures(GL gl)
Creates Texture objects based on files named in PATTERNS_CONFIG.

A Texture with the menu name "None" and the OpenGL texture name (an integer) of zero will be added to the Vector before the Texture objects created by reading from files.

Parameters:
gl - the current GL object.

createHalftoningTextures

public Vector<Texture> createHalftoningTextures(GL gl)
Creates Texture objects based on files named in HALFTONING_CONFIG.

A Texture with the menu name "None" and the OpenGL texture name (an integer) of zero will be added to the Vector before the Texture objects created by reading from files.

Parameters:
gl - the current GL object.

createBendTextures

public Vector<Texture> createBendTextures(GL gl)
Creates Texture objects based on files named in BEND_CONFIG.

A Texture with the menu name "None" and the OpenGL texture name (an integer) of zero will be added to the Vector before the Texture objects created by reading from files.

Parameters:
gl - the current GL object.

createTextures

public Vector<Texture> createTextures(GL gl,
                                      String directory,
                                      String configName)
Creates Texture objects based on files named in the CONFIG_FILE.

A Texture with the menu name "None" and the OpenGL texture name (an integer) of zero will be added to the Vector before the Texture objects created by reading from files.

Parameters:
configName - the complete name of the config file to read.
directory - the directory for the config and textures files.
gl - the current GL object.

getErrors

public List<TextureException> getErrors()
Returns a list with any exceptions that occurred the last time that createTextures() was called.

If there were no errors, then the list will have a length of zero.

Returns:
A list of TextureExceptions.


Copyright © 2007-2008