|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.graphics.shader.ShaderProgramFactory
public class ShaderProgramFactory
Knows how to compile and link an OpenGL Shading Language vertex shader and fragment shader to get an OpenGL "program" object.
Field Summary | |
---|---|
static String |
SHADER_DIRECTORY
Specifies the directory the OpenGL Shading Language vertex and fragment shaders are kept in. |
Constructor Summary | |
---|---|
ShaderProgramFactory()
Constructs a ShaderProgramFactory. |
Method Summary | |
---|---|
ShaderProgram |
compile(GL gl,
ShaderEnum pair)
Reads a pair of vertex and fragment shader files and then compiles and links them. |
List<ShaderProgram> |
compileAllShaders(GL gl)
Compiles all shaders pairs defined by the ShaderEnum. |
ShaderProgram |
createShaderProgram(GL gl,
File vertFile,
File fragFile,
ShaderEnum pair)
Reads source code files for a vertex shader and a fragment shader and creates an OpenGL shader program object. |
ShaderProgram |
createShaderProgram(GL gl,
String vertFilename,
String fragFilename,
ShaderEnum pair)
Reads source code files for a vertex shader and a fragment shader and creates an OpenGL shader program object. |
void |
deleteShaderProgram(GL gl,
ShaderProgram program)
Calls delete on each OpenGL shader and program object name held by the ShaderProgram given as an argument. |
List<ShaderException> |
getErrors()
Returns a list with all ShaderExceptions that occurred during the last call to compileAllShaders(). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SHADER_DIRECTORY
Constructor Detail |
---|
public ShaderProgramFactory()
Method Detail |
---|
public List<ShaderProgram> compileAllShaders(GL gl)
gl
- the current GL object.
public List<ShaderException> getErrors()
public ShaderProgram compile(GL gl, ShaderEnum pair) throws ShaderException
gl
- the current GL object.pair
- a ShaderEnum with the names of the vertex and fragment files.
ShaderException
- if the shader program object cannot be obtained.public ShaderProgram createShaderProgram(GL gl, String vertFilename, String fragFilename, ShaderEnum pair) throws ShaderException
gl
- the current GL object.vertFilename
- the file with the vertex shader code.fragFilename
- the file with the fragment shader code.pair
- a ShaderEnum with the names of the vertex and fragment files.
ShaderException
- if the shader program object cannot be
obtained.public ShaderProgram createShaderProgram(GL gl, File vertFile, File fragFile, ShaderEnum pair) throws ShaderException
gl
- the current GL object.vertFile
- the file with the vertex shader code.fragFile
- the file with the fragment shader code.pair
- a ShaderEnum with the names of the vertex and fragment files.
ShaderException
- if the shader program object cannot be
obtained.public void deleteShaderProgram(GL gl, ShaderProgram program)
gl
- the current GL object.program
- the Java ShaderProgram object holding the OpenGL
references.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |