|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.graphics.shader.ShaderManager
public class ShaderManager
Knows how to use a ShaderProgramFactory to compile OpenGL shader
programs and has methods to enable shaders.
Shader programs are provided for Phong lighting, single-pass wireframe
rendering, texture mapped text, patterns, and real-time halftoning.
See ShaderEnum for a list of all shader programs.
When the compileShaders(gl) method is called, the ShaderProgramFactory will be
asked to compile all of the ShaderPrograms that it can (based on the vertex and
fragment shader filenames found in the ShaderEnum). Any ShaderExceptions
thrown while trying to compile and linke a ShaderProgram will be saved in a
list of errors that will be checked only after all ShaderPrograms that can
be compiled and linked have been stored. If one or more ShaderExceptions
did occur, then the very last thing the compileShaders(gl) method will do
is throw a single ShaderException. If there will multiple errors, then all
of the errors will be bundled into the message of the single exception that
gets thrown. For any shaders that are missing, the built-in OpenGL lighting
will be used instead.
Constructor Summary | |
---|---|
ShaderManager()
Constructs a ShaderManager. |
Method Summary | |
---|---|
void |
compileShaders(GL gl)
Compiles the OpenGL Shading Language vertex and fragment shaders needed for Phong lighting, text label mapping, and real-time hafltoning. |
void |
deleteShaders(GL gl)
Frees graphics card memory for all shaders. |
void |
enableFPSShaders(GL gl,
int texture)
Calls on glUseProgram() to make the fps (frames per second label) shader pair the active shader program. |
int |
enableGrayscaleShaders(GL gl)
Calls on glUseProgram() to make the grayscale shader pair the active shader program. |
void |
enablePatternsShaders(GL gl,
int texture)
Calls on glUseProgram() to make the patterns shader pair the active shader program. |
int |
enablePhongShaders(GL gl)
Calls on glUseProgram() to make the Phong shader pair the active shader program. |
void |
enableRibbonHalftoningShaders(GL gl,
int halftoningTexture,
int bendTexture,
float bendFactor,
boolean startLine,
boolean endLine,
float sCoordStart,
float sCoordEnd)
Calls on glUseProgram() to make the ribbon halftoning shader pair the active shader program. |
int |
enableSilhouetteShaders(GL gl,
boolean startLine,
boolean endLine)
Calls on glUseProgram() to make the silhouette shader pair the active shader program. |
int |
enableTextLabelShaders(GL gl)
Calls on glUseProgram() to make the text-label shader pair the active shader program. |
void |
enableTubeCapHalftoningShaders(GL gl,
int texture)
Calls on glUseProgram() to make the tube cap halftoning shader pair the active shader program. |
int |
enableTubeCapWireframeShaders(GL gl)
Calls on glUseProgram() to make the tube cap wireframe shader pair the active shader program. |
void |
enableTubeHalftoningShaders(GL gl,
int halftoningTexture,
int bendTexture,
float bendFactor,
boolean startLine,
boolean endLine)
Calls on glUseProgram() to make the tube halftoning shader pair the active shader program. |
int |
enableWireframeShaders(GL gl,
float sMin,
float sDelta,
float tDelta)
Calls on glUseProgram() to make the wireframe shader pair the active shader program. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShaderManager()
Method Detail |
---|
public void compileShaders(GL gl) throws ShaderException
gl
- the current GL object.
ShaderException
- if a shader program object cannot be
obtained.public void deleteShaders(GL gl)
gl
- the current GL object.public int enablePhongShaders(GL gl)
gl
- the current GL object.
public int enableWireframeShaders(GL gl, float sMin, float sDelta, float tDelta)
gl
- the current GL object.sMin
- the minimum s-coordinate for texture mapping.sDelta
- the spacing of lines along the s-coordinate axis.tDelta
- the spacing of lines along the t-coordinate axis.
public int enableTubeCapWireframeShaders(GL gl)
gl
- the current GL object.
public int enableTextLabelShaders(GL gl)
gl
- the current GL object.
public void enablePatternsShaders(GL gl, int texture)
gl
- the current GL object.texture
- the name (an integer) of an OpenGL texture object.public void enableTubeHalftoningShaders(GL gl, int halftoningTexture, int bendTexture, float bendFactor, boolean startLine, boolean endLine)
gl
- the current GL object.halftoningTexture
- the name of the halftoning texture.bendTexture
- the name of the bend texture.bendFactor
- factor from 0 (no bend) to 1.0 (max bend).startLine
- determines if a start line is drawn.endLine
- determines if an end line is drawn.public void enableTubeCapHalftoningShaders(GL gl, int texture)
gl
- the current GL object.texture
- the name (an integer) of an OpenGL texture
object.public void enableRibbonHalftoningShaders(GL gl, int halftoningTexture, int bendTexture, float bendFactor, boolean startLine, boolean endLine, float sCoordStart, float sCoordEnd)
gl
- the current GL object.halftoningTexture
- the name of the halftoning texture.bendTexture
- the name of the bend texture.bendFactor
- factor from 0 (no bend) to 1.0 (max bend).startLine
- determines if a start line should be drawn.endLine
- determines if an end line should be drawn.sCoordStart
- the min value of the texture s-coordinate.sCoordEnd
- the max value of the texture s-coordinate.public int enableGrayscaleShaders(GL gl)
gl
- the current GL object.
public void enableFPSShaders(GL gl, int texture)
gl
- the current GL object.texture
- the name (an integer) of an OpenGL texture object.public int enableSilhouetteShaders(GL gl, boolean startLine, boolean endLine)
gl
- the current GL object.startLine
- determines if a start line is drawn.endLine
- determines if an end line is drawn.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |