Module gl1

Class CachedShaderCollection

java.lang.Object
de.grogra.glsl.utility.CachedShaderCollection

public class CachedShaderCollection extends Object
Interface for all GLSLShaders. Activates / compiles and deletes shaderprograms. Holds a list of all GLSLShaders.
Author:
Konni Hartmann
  • 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 inside shaderCache
      Parameters:
      glState - current GL instance
      disp - active GLDisplay instance
      s - 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 inside shaderCache
      Parameters:
      glState - current GL instance
      disp - active GLDisplay instance
      s - shader that should be activated
    • setCurrentStamp

      public void setCurrentStamp(int stamp)
    • removeUnusedShaders

      public void removeUnusedShaders(OpenGLState glState)
      Removes unused GLSLShaders from shaderCache
      Parameters:
      glState -
    • getCurrentShader

      public GLSLManagedShader 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

      public void deleteAll(OpenGLState glState, boolean javaonly)
      Remove all compiled Shaders from shaderCache and shaderMap.
      Parameters:
      glState -