Class ShaderProgram
java.lang.Object
com.marginallyclever.ro3.apps.viewport.ShaderProgram
ShaderProgram
is a wrapper for vertex and fragment shader programs. It also provides a simple interface
for setting uniforms.
-
Constructor Summary
ConstructorDescriptionShaderProgram
(com.jogamp.opengl.GL3 gl, String[] vertexCode, String[] fragmentCode) -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(com.jogamp.opengl.GL3 gl) int
int
getUniformLocation
(com.jogamp.opengl.GL3 gl, String name) void
void
void
void
void
void
void
setMatrix4d
(com.jogamp.opengl.GL3 gl, String name, javax.vecmath.Matrix4d value) Set a matrix in the shader.void
setVector3d
(com.jogamp.opengl.GL3 gl, String name, javax.vecmath.Vector3d value) void
use
(com.jogamp.opengl.GL3 gl)
-
Constructor Details
-
ShaderProgram
-
-
Method Details
-
use
public void use(com.jogamp.opengl.GL3 gl) -
delete
public void delete(com.jogamp.opengl.GL3 gl) -
getProgramId
public int getProgramId() -
getUniformLocation
-
set1f
-
set2f
-
set3f
-
set4f
-
setVector3d
-
setMatrix4d
Set a matrix in the shader. OpenGL uses column-major order, where Java and DirectX use row-major order. Don't forget to transpose!- Parameters:
gl
- the viewport contextname
- the name of the uniform variablevalue
- the matrix to set
-
set1i
-
setColor
-