Class ProgramsManager
java.lang.Object
cz.fidentis.analyst.glsl.code.impl.ProgramsManager
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
compileMissingShaders
(Collection<GlslShaderDef> shaderSpecs) com.jogamp.opengl.GLContext
Returns the OpenGL contextgetOrCompile
(GlslProgramDef programSpec) Lazy compilation and re-used of GLSL programs.void
release
(GlslProgramDef programDef, boolean preserveShaders) Removes the program and its shaders from this manager and from GPU memory.void
releaseAll
(boolean preserveShaders) Removes all programs, asks for releasing GPU memory.
-
Constructor Details
-
Method Details
-
getOrCompile
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
-
release
Removes the program and its shaders from this manager and from GPU memory.- Parameters:
programDef
- Which GLSL program to releasepreserveShaders
- Iftrue
, then linked shaders remain allocated on GPU even if they are not used by any program. Iffalse
, then such shaders are released from the GPU memory
-
releaseAll
public void releaseAll(boolean preserveShaders) Removes all programs, asks for releasing GPU memory.- Parameters:
preserveShaders
- Iftrue
, then linked shaders remain allocated on GPU. Iffalse
, then all shaders are released from the GPU memory.
-
getGlContext
public com.jogamp.opengl.GLContext getGlContext()Returns the OpenGL context- Returns:
- the OpenGL context
-