Package cz.fidentis.analyst.glsl.code
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 TypeMethodDescriptionReturns the GLSL program definition which was used to create this program.int
Returns the ID of the program in the OpenGL contextint
getUniformLocation
(String key) Returns ID of the given named uniform location in the OpenGL context.void
setMat4fVar
(String varName, float[] value) Sets the value to a uniformMatrix4fv
variable defined in the compiled program.void
setNumberVar
(String varName, Number value) Sets the value to a uniform1f
or1i
variable defined in the compiled program.void
setVec4fVar
(String varName, float v1, float v2, float v3, float v4) Sets the value to a uniform4f
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
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
Sets the value to a uniformMatrix4fv
variable defined in the compiled program.- Parameters:
varName
- variable name (seeGlslProgramDef
)value
- Value to be assigned- Throws:
UnsupportedOperationException
- if the variable does nto exist or the value is nto supported.
-
setNumberVar
Sets the value to a uniform1f
or1i
variable defined in the compiled program.- Parameters:
varName
- variable name (seeGlslProgramDef
)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
Sets the value to a uniform4f
variable defined in the compiled program.- Parameters:
varName
- variable name (seeGlslProgramDef
)v1
- First value to be assignedv2
- Second value to be assignedv3
- Third value to be assignedv4
- Fourth value to be assigned- Throws:
UnsupportedOperationException
- if the variable does nto exist or the value is nto supported.
-