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. Java uses column-major order, where OpenGL and DirectX use row-major order. Thus the thurd parameter is true to make the video card transpose the matrix from row-major to column-major.- Parameters:
gl
- the viewport contextname
- the name of the uniform variablevalue
- the matrix to set- See Also:
-
set1i
-
setColor
-