java.lang.Object
de.grogra.glsl.utility.CachedShaderCollection
Interface for all GLSLShaders. Activates / compiles and deletes
shaderprograms. Holds a list of all GLSLShaders.
- Author:
- Konni Hartmann
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteAll
(OpenGLState glState, boolean javaonly) Remove all compiled Shaders fromshaderCache
andshaderMap
.void
findAndActivateShader
(OpenGLState glState, GLSLDisplay disp, ShaderConfiguration sc, Shader s) Will obtain and activate a GLSLShader to emulate the input shaders behavior.findShader
(OpenGLState glState, GLSLDisplay disp, ShaderConfiguration sc, Shader s) Will obtain a GLSLShader to emulate the input shaders behavior.getCacheEntry
(OpenGLState glState, GLSLDisplay disp, ShaderConfiguration sc, Object s) Retrieve the cached entry for a Configuration/Object-Pair.Get current active GLSLShader.void
removeUnusedShaders
(OpenGLState glState) Removes unused GLSLShaders fromshaderCache
void
setCurrentStamp
(int stamp)
-
Constructor Details
-
CachedShaderCollection
public CachedShaderCollection()
-
-
Method Details
-
getCacheEntry
public GLSLManagedShader getCacheEntry(OpenGLState glState, GLSLDisplay disp, ShaderConfiguration sc, Object s) Retrieve the cached entry for a Configuration/Object-Pair. If no entry exists method will generate and store a new one- Parameters:
sc
-s
-- Returns:
- the fetched managed Shader
-
findAndActivateShader
public void findAndActivateShader(OpenGLState glState, GLSLDisplay disp, ShaderConfiguration sc, Shader s) Will obtain and activate a GLSLShader to emulate the input shaders behavior. Will cache instances of GLSLShaders insideshaderCache
- Parameters:
glState
- current GL instancedisp
- active GLDisplay instances
- shader that should be activated
-
findShader
public GLSLManagedShader findShader(OpenGLState glState, GLSLDisplay disp, ShaderConfiguration sc, Shader s) Will obtain a GLSLShader to emulate the input shaders behavior. Will cache instances of GLSLShaders insideshaderCache
- Parameters:
glState
- current GL instancedisp
- active GLDisplay instances
- shader that should be activated
-
setCurrentStamp
public void setCurrentStamp(int stamp) -
removeUnusedShaders
Removes unused GLSLShaders fromshaderCache
- Parameters:
glState
-
-
getCurrentShader
Get current active GLSLShader. Will only work for managed Shaders. If a non managed Shader is active result is undefined.- Returns:
- returns active shader as corresponding GLSLShaderManagedShader
-
deleteAll
Remove all compiled Shaders fromshaderCache
andshaderMap
.- Parameters:
glState
-
-