Interface GlslServices


public interface GlslServices
Stateless services for compiling vertex and fragment shaders and composing them into GLSL programs.
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    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 the useProgram() service.
    useProgram(com.jogamp.opengl.GLContext glContext, GlslProgramDef programDef)
    Compiles the GLSL program, re-uses already compiled programs.
  • Method Details

    • useProgram

      static GlslProgram useProgram(com.jogamp.opengl.GLContext glContext, GlslProgramDef programDef)
      Compiles the GLSL program, re-uses already compiled programs.
      Parameters:
      glContext - OpenGL context. Must not be null. 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 the useProgram() service. Do not forget to bind necessary buffers before running GLSL program - see registerBuffers(com.jogamp.opengl.GLContext, cz.fidentis.analyst.glsl.buffergroups.BufferGroupDef), GlslBufferGroup.bindBuffer(cz.fidentis.analyst.glsl.buffers.BufferDef) and GlslBufferGroup.bindSsboBuffers().
      Parameters:
      glContext - OpenGL context. Must not be null. 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 - see GlslBufferGroup.destroyBuffers().
      Parameters:
      glContext - OpenGL context. Must not be null. 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 be null. Must be at least GL2.