hmi.graphics.opengl
Class GLTextures
java.lang.Object
hmi.graphics.opengl.GLTextures
public class GLTextures
- extends Object
A utility class for GLTextures, in particular for loading and caching GLTexture objects.
Basic usage: 1) GLTextures.getGLTexture(imageFile) will retrieve (and cache) a texture file
within the default texture resource directory. (Default for HmiShared projects: the resource/textures directory)
2) GLTextures.addTextureDirectory(textureDir) adds the textureDir directory for searching textures image files.
All texture directories are loaded as Java resources, implying that the path where some texture directory is located
must be included on the Java classpath. Such is the case for the resource directory within a HmiShared style project.
|
Method Summary |
static void |
addTextureDirectory(String dir)
|
static GLTexture |
getGLTexture(String resourceName)
Tries to get a GLTexture with the specified resource name, either from the cache
or else from loading (and caching) an image from one of the texture directories. |
static GLTexture |
getGLTexture(String resourceName,
boolean flip,
boolean rescale)
Tries to get a GLTexture with the specified resource name. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pool
private static ResourcePool pool
DEFAULT_TEXTURE_RESOURCE_DIR
public static final String DEFAULT_TEXTURE_RESOURCE_DIR
- See Also:
- Constant Field Values
GLTextures
public GLTextures()
addTextureDirectory
public static void addTextureDirectory(String dir)
getGLTexture
public static GLTexture getGLTexture(String resourceName)
- Tries to get a GLTexture with the specified resource name, either from the cache
or else from loading (and caching) an image from one of the texture directories.
The image is flipped vertically and when necessary rescaled to a power-of-two size.
getGLTexture
public static GLTexture getGLTexture(String resourceName,
boolean flip,
boolean rescale)
- Tries to get a GLTexture with the specified resource name.
GLTexture objects found and loaded will be cached.
The flip and rescale attributes are used when the texture is
loaded for the first time (not when a cached version is retrieved).
They denote whether the image should be flipped vertically (usually they should
for OpenGL texturing), and whether a non-power-of-two image should be rescaled
to the next power-of-two size. (Default is to rescale)