Package cz.fidentis.analyst.glsl
Interface GlslServices
public interface GlslServices
Stateless services for compiling vertex and fragment shaders and composing them into GLSL programs.
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic GlslBufferGroup
registerBuffers
(com.jogamp.opengl.GLContext glContext, BufferGroupDef bufferGroupDef) Registers a bunch of buffers required by a GLSL program(s) in given GL context.static void
release
(com.jogamp.opengl.GLContext glContext) Should be called before the OpenGL context is erased.static void
runProgram
(com.jogamp.opengl.GLContext glContext, int numGroupsX, int numGroupsY, int numGroupsZ) Executes the GLSL program previously set by theuseProgram()
service.static GlslProgram
useProgram
(com.jogamp.opengl.GLContext glContext, GlslProgramDef programDef) Compiles the GLSL program, re-uses already compiled programs.
-
Method Details
-
useProgram
Compiles the GLSL program, re-uses already compiled programs.- Parameters:
glContext
- OpenGL context. Must not benull
. Must be at least GL2.programDef
- GLSL program definition- Returns:
- The reference object to the compiled GLSL program
-
runProgram
static void runProgram(com.jogamp.opengl.GLContext glContext, int numGroupsX, int numGroupsY, int numGroupsZ) Executes the GLSL program previously set by theuseProgram()
service. Do not forget to bind necessary buffers before running GLSL program - seeregisterBuffers(com.jogamp.opengl.GLContext, cz.fidentis.analyst.glsl.buffergroups.BufferGroupDef)
,GlslBufferGroup.bindBuffer(cz.fidentis.analyst.glsl.buffers.BufferDef)
andGlslBufferGroup.bindSsboBuffers()
.- Parameters:
glContext
- OpenGL context. Must not benull
. Must be at least GL4.numGroupsX
- The number of work groups to be launched in the X dimension.numGroupsY
- The number of work groups to be launched in the Y dimension.numGroupsZ
- The number of work groups to be launched in the Z dimension.
-
registerBuffers
static GlslBufferGroup registerBuffers(com.jogamp.opengl.GLContext glContext, BufferGroupDef bufferGroupDef) Registers a bunch of buffers required by a GLSL program(s) in given GL context. Registered buffers are unbound and do not have allocated space. You must destroy these buffers before they go out of scope, or you create a memory leak in GL context - seeGlslBufferGroup.destroyBuffers()
.- Parameters:
glContext
- OpenGL context. Must not benull
. Must be at least GL4.- Returns:
- the group of initialized buffers
-
release
static void release(com.jogamp.opengl.GLContext glContext) Should be called before the OpenGL context is erased.- Parameters:
glContext
- OpenGL context. Must not benull
. Must be at least GL2.
-