hmi.graphics.opengl
Class GLShaders

java.lang.Object
  extended by hmi.graphics.opengl.GLShaders

public class GLShaders
extends Object

A utility class for GLShaders, in particular for loading and caching GLShader objects. Basic usage: 1) GLShaders.getGLShader(shaderFile) will retrieve (and cache) a shader within the default shader resource directory. (Default for HmiShared projects: the resource/shaders directory) 2) GLShaders.addShaderDirectory(shaderDir) adds the shaderDir directory for searching shader files. All shader directories are loaded as Java resources, implying that the path where some shader directory is located must be included on the Java classpath. Such is the case for the resource directory within a HmiShared style project.


Nested Class Summary
private static class GLShaders.Pool
           
 
Field Summary
static String DEFAULT_SHADER_RESOURCE_DIR
           
private static List<GLShaders.Pool> poolList
           
 
Constructor Summary
GLShaders()
           
 
Method Summary
static void addShaderDirectory(String shaderDir)
          Adds the specified directory to the (front of the) list of resource directories to be searched When some resource is actually present in more than one directory in the list, the version from the directory that was added latest will take preference.
private static GLShaders.Pool findPool(String resourceDir)
           
static GLShader getGLShader(String shaderName)
          Tries to get a GLShader with the specified name from any of the current list of shader directories.
static GLShader getGLShader(String shaderDir, String shaderName)
          Tries to get a GLShader from the specified shader directory, with the specified shader name GLShader objects found and loaded will be cached in the shader pool associated with the specified resource directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

poolList

private static List<GLShaders.Pool> poolList

DEFAULT_SHADER_RESOURCE_DIR

public static final String DEFAULT_SHADER_RESOURCE_DIR
See Also:
Constant Field Values
Constructor Detail

GLShaders

public GLShaders()
Method Detail

addShaderDirectory

public static void addShaderDirectory(String shaderDir)
Adds the specified directory to the (front of the) list of resource directories to be searched When some resource is actually present in more than one directory in the list, the version from the directory that was added latest will take preference.


getGLShader

public static GLShader getGLShader(String shaderDir,
                                   String shaderName)
Tries to get a GLShader from the specified shader directory, with the specified shader name GLShader objects found and loaded will be cached in the shader pool associated with the specified resource directory.


getGLShader

public static GLShader getGLShader(String shaderName)
Tries to get a GLShader with the specified name from any of the current list of shader directories. GLTexture objects found and loaded will be cached in the texture pool associated with the (first) resource directory where it was found.


findPool

private static GLShaders.Pool findPool(String resourceDir)