java.lang.Object
de.grogra.glsl.utility.GLSLShader
- All Implemented Interfaces:
GLSLOpenGLObject
- Direct Known Subclasses:
GLSLManagedShader
Base for all complete shaders like
- Author:
- Konni Hartmann
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activateShader
(OpenGLState glState, GLSLDisplay disp, Object data) Only public method.void
cleanup
(OpenGLState glState, boolean javaonly) void
deleteShader
(javax.media.opengl.GL gl, boolean javaonly) Remove OpenGL side of this shaderprotected abstract String[]
getFragmentShader
(Object data) For "hardcompiled" Shaders this method should return a new instanceint
Getter for Shader Programnumberprotected String[]
getVertexShader
(Object data) boolean
needsRecompilation
(Object data) Return false if Shader depends only on Uniformsprotected static void
printProgramInfoLog
(javax.media.opengl.GL gl, int program) Same asprintShaderInfoLog
only for Programs.protected void
setupDynamicUniforms
(javax.media.opengl.GL gl, GLSLDisplay disp, Object data, int shaderNo) Function that loads uniforms of the represented Shader.protected void
setupShader
(javax.media.opengl.GL gl, GLSLDisplay disp, Object data)
-
Constructor Details
-
GLSLShader
-
-
Method Details
-
printProgramInfoLog
protected static void printProgramInfoLog(javax.media.opengl.GL gl, int program) Same asprintShaderInfoLog
only for Programs.- Parameters:
gl
-program
-
-
getShaderProgramNumber
public int getShaderProgramNumber()Getter for Shader Programnumber- Returns:
- the OpenGL id of the associated shader-program-id
-
needsRecompilation
Return false if Shader depends only on Uniforms- Parameters:
s
- Associated Shader- Returns:
- true, if Sourcecode needs to be regenerated and recompiled
-
instanceFor
- Returns:
- Class represented by this Shader
-
getInstance
For "hardcompiled" Shaders this method should return a new instance- Returns:
-
getVertexShader
- Parameters:
sh
-- Returns:
-
getFragmentShader
- Parameters:
sh
-- Returns:
-
setupDynamicUniforms
protected void setupDynamicUniforms(javax.media.opengl.GL gl, GLSLDisplay disp, Object data, int shaderNo) Function that loads uniforms of the represented Shader.- Parameters:
gl
-disp
- GLSLDisplay that tries using this shaderdata
- The GroIMP-Shader-Object represented by this shader.
-
setupShader
- Parameters:
gl
-disp
-s
-
-
activateShader
Only public method. Use this to activate (and compile) this Shader for use in rendering.- Parameters:
gl
-disp
-sh
-s
-
-
deleteShader
public void deleteShader(javax.media.opengl.GL gl, boolean javaonly) Remove OpenGL side of this shader- Parameters:
gl
-
-
cleanup
- Specified by:
cleanup
in interfaceGLSLOpenGLObject
-