Interface GlslProgram

All Known Implementing Classes:
CompiledProgram

public interface GlslProgram
A GLSL program, which links multiple shaders together, for example vertex shader and a fragment shader. Update the GlslProgramDef and GlslShaderDef enums whenever you want to add a new GLSL program and its shaders. Update the GlslBufferGroup enum to define their buffers.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the GLSL program definition which was used to create this program.
    int
    Returns the ID of the program in the OpenGL context
    int
    Returns ID of the given named uniform location in the OpenGL context.
    void
    setMat4fVar(String varName, float[] value)
    Sets the value to a uniform Matrix4fv variable defined in the compiled program.
    void
    setNumberVar(String varName, Number value)
    Sets the value to a uniform 1f or 1i variable defined in the compiled program.
    void
    setVec4fVar(String varName, float v1, float v2, float v3, float v4)
    Sets the value to a uniform 4f variable defined in the compiled program.
  • Method Details

    • getProgramId

      int getProgramId()
      Returns the ID of the program in the OpenGL context
      Returns:
      program's ID
    • getProgramDef

      GlslProgramDef getProgramDef()
      Returns the GLSL program definition which was used to create this program.
      Returns:
      program's definition
    • getUniformLocation

      int getUniformLocation(String key)
      Returns ID of the given named uniform location in the OpenGL context.
      Parameters:
      key - name
      Returns:
      ID of the given named uniform location in the OpenGL context or -1
    • setMat4fVar

      void setMat4fVar(String varName, float[] value)
      Sets the value to a uniform Matrix4fv variable defined in the compiled program.
      Parameters:
      varName - variable name (see GlslProgramDef)
      value - Value to be assigned
      Throws:
      UnsupportedOperationException - if the variable does nto exist or the value is nto supported.
    • setNumberVar

      void setNumberVar(String varName, Number value)
      Sets the value to a uniform 1f or 1i variable defined in the compiled program.
      Parameters:
      varName - variable name (see GlslProgramDef)
      value - Value to be assigned. Must be either float or integer
      Throws:
      UnsupportedOperationException - if the variable does nto exist or the value is nto supported.
    • setVec4fVar

      void setVec4fVar(String varName, float v1, float v2, float v3, float v4)
      Sets the value to a uniform 4f variable defined in the compiled program.
      Parameters:
      varName - variable name (see GlslProgramDef)
      v1 - First value to be assigned
      v2 - Second value to be assigned
      v3 - Third value to be assigned
      v4 - Fourth value to be assigned
      Throws:
      UnsupportedOperationException - if the variable does nto exist or the value is nto supported.