Class ProgramsManager

java.lang.Object
cz.fidentis.analyst.glsl.code.impl.ProgramsManager

public class ProgramsManager extends Object
This object deals with shaders and programs of a single OpenGL context. Compiled shaders can be used by multiple programs of the context and vice versa. The compilation of shaders and programs is lazy (only after the first request).
  • Constructor Details Link icon

    • ProgramsManager Link icon

      public ProgramsManager(com.jogamp.opengl.GLContext glContext)
      Constructor.
      Parameters:
      glContext - OpenGL context. Must not be null. Must be at least GL2.
  • Method Details Link icon

    • getOrCompile Link icon

      public CompiledProgram getOrCompile(GlslProgramDef programSpec) throws com.jogamp.opengl.GLException
      Lazy compilation and re-used of GLSL programs.
      Parameters:
      programSpec - Which GLSL program to compile/return
      Returns:
      The reference object to the compiled GLSL program
      Throws:
      com.jogamp.opengl.GLException - if the compilation fails
    • compileMissingShaders Link icon

      protected void compileMissingShaders(Collection<GlslShaderDef> shaderSpecs)
    • release Link icon

      public void release(GlslProgramDef programDef, boolean preserveShaders)
      Removes the program and its shaders from this manager and from GPU memory.
      Parameters:
      programDef - Which GLSL program to release
      preserveShaders - If true, then linked shaders remain allocated on GPU even if they are not used by any program. If false, then such shaders are released from the GPU memory
    • releaseAll Link icon

      public void releaseAll(boolean preserveShaders)
      Removes all programs, asks for releasing GPU memory.
      Parameters:
      preserveShaders - If true, then linked shaders remain allocated on GPU. If false, then all shaders are released from the GPU memory.
    • getGlContext Link icon

      public com.jogamp.opengl.GLContext getGlContext()
      Returns the OpenGL context
      Returns:
      the OpenGL context