Package org.jzy3d.io.glsl
Class GLSLProgram
java.lang.Object
org.jzy3d.io.glsl.GLSLProgram
Below is description of the GLSL program lifecycle, with Jzy3d methods, and underlying OpenGL
methods.
- load shaders with
invalid @link
attachVertexShader()
invalid @link
attachFragmentShader()
- glCreateShader
- glShaderSource
- glCompileShader
- glGetShaderiv (verify status)
- glGetShaderInfoLog (log errors)
- link(gl) links the compiled shaders
- glCreateProgram
- glAttachShader
- glLinkProgram
- glGetProgramiv (verify status)
- glGetProgramInfoLog (log errors)
- glValidateProgram
- bind(gl) mount the program @ rendering
- glUseProgram
-
invalid @link
bindTextureRECT(gl)
- unbind(gl) unmount the program @ rendering
- glUseProgram(0)
- destroy(gl)
- glDeleteShader
- glDeleteProgram
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
Control the behaviour of a GLSL program with errors (throwing exceptions, create warnings, etc) -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic GLSLProgram.Strictness
protected static org.apache.logging.log4j.Logger
protected Integer
protected GLSLProgram.Strictness
static boolean
protected StringBuffer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(com.jogamp.opengl.GL2 gl) void
bindTexture
(com.jogamp.opengl.GL2 gl, int target, String texname, int texid, int texunit) void
bindTexture2D
(com.jogamp.opengl.GL2 gl, String texname, int texid, int texunit) void
bindTexture3D
(com.jogamp.opengl.GL2 gl, String texname, int texid, int texunit) void
bindTextureRECT
(com.jogamp.opengl.GL2 gl, String texname, int texid, int texunit) protected void
checkShaderLogInfo
(com.jogamp.opengl.GL2 inGL, int shaderObjectID) read logs and either throw exception, print to console or append to error log according to the configuredGLSLProgram.Strictness
void
compileFragmentShader
(com.jogamp.opengl.GL2 gl, URL infoURL, String content) void
compileVertexShader
(com.jogamp.opengl.GL2 gl, URL infoURL, String content) void
destroy
(com.jogamp.opengl.GL2 gl) void
link
(com.jogamp.opengl.GL2 gl) void
link
(com.jogamp.opengl.GL2 gl, boolean validateImmediatly) Create a program and attach previously loaded and compiled shaders.void
loadAndCompileFragmentShader
(com.jogamp.opengl.GL2 gl, InputStream stream) void
loadAndCompileFragmentShader
(com.jogamp.opengl.GL2 gl, InputStream stream, URL infoURL) void
loadAndCompileFragmentShader
(com.jogamp.opengl.GL2 gl, URL fileURL) void
loadAndCompileShaders
(com.jogamp.opengl.GL2 gl, ShaderFilePair files) void
loadAndCompileVertexShader
(com.jogamp.opengl.GL2 gl, InputStream stream) void
loadAndCompileVertexShader
(com.jogamp.opengl.GL2 gl, InputStream stream, URL infoURL) void
loadAndCompileVertexShader
(com.jogamp.opengl.GL2 gl, URL fileURL) readErrors
(com.jogamp.opengl.GL2 gl, int iID) void
setTextureUnit
(com.jogamp.opengl.GL2 gl, String texname, int texunit) void
setUniform
(com.jogamp.opengl.GL2 gl, String name, float value) void
setUniform
(com.jogamp.opengl.GL2 gl, String name, float[] values, int count) void
unbind
(com.jogamp.opengl.GL2 gl) void
validateProgram
(com.jogamp.opengl.GL2 gl) void
verifyLinkStatus
(com.jogamp.opengl.GL2 gl, int programId) void
verifyShaderCompiled
(com.jogamp.opengl.GL2 gl, URL fileURL, int programId, String content) protected void
warn
(String info, GLSLProgram.GLSLWarnType type) protected void
protected void
warnScript
(com.jogamp.opengl.GL2 gl, URL fileURL, String error, int compileStatus, int logLength, String content)
-
Field Details
-
DEFAULT_STRICTNESS
-
WARN_SHOW_SHADER_SOURCE
public static boolean WARN_SHOW_SHADER_SOURCE -
log
protected static org.apache.logging.log4j.Logger log -
programId
-
vertexShaders_
-
fragmentShaders_
-
warnBuffer
-
strictness
-
-
Constructor Details
-
GLSLProgram
public GLSLProgram() -
GLSLProgram
-
-
Method Details
-
link
public void link(com.jogamp.opengl.GL2 gl) -
link
public void link(com.jogamp.opengl.GL2 gl, boolean validateImmediatly) Create a program and attach previously loaded and compiled shaders. Performs validation and warn according to program strictness. -
bind
public void bind(com.jogamp.opengl.GL2 gl) -
unbind
public void unbind(com.jogamp.opengl.GL2 gl) -
destroy
public void destroy(com.jogamp.opengl.GL2 gl) -
setUniform
-
setUniform
-
setTextureUnit
-
bindTexture
public void bindTexture(com.jogamp.opengl.GL2 gl, int target, String texname, int texid, int texunit) -
bindTexture2D
-
bindTexture3D
-
bindTextureRECT
-
loadAndCompileShaders
-
loadAndCompileVertexShader
-
loadAndCompileVertexShader
-
loadAndCompileVertexShader
- Parameters:
gl
-stream
- shader source code ressourceinfoURL
- only used as information for warnings if shader does not compile properly
-
loadAndCompileFragmentShader
-
loadAndCompileFragmentShader
-
loadAndCompileFragmentShader
-
compileVertexShader
-
compileFragmentShader
-
verifyShaderCompiled
-
verifyLinkStatus
public void verifyLinkStatus(com.jogamp.opengl.GL2 gl, int programId) -
readErrors
-
validateProgram
public void validateProgram(com.jogamp.opengl.GL2 gl) -
checkShaderLogInfo
protected void checkShaderLogInfo(com.jogamp.opengl.GL2 inGL, int shaderObjectID) read logs and either throw exception, print to console or append to error log according to the configuredGLSLProgram.Strictness
-
warnScript
-
warnLink
-
warn
-
getProgramId
-