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
and
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 enumstatic enumControl the behaviour of a GLSL program with errors (throwing exceptions, create warnings, etc) -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic GLSLProgram.Strictnessprotected static org.apache.logging.log4j.Loggerprotected Integerprotected GLSLProgram.Strictnessstatic booleanprotected StringBuffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(com.jogamp.opengl.GL2 gl) voidbindTexture(com.jogamp.opengl.GL2 gl, int target, String texname, int texid, int texunit) voidbindTexture2D(com.jogamp.opengl.GL2 gl, String texname, int texid, int texunit) voidbindTexture3D(com.jogamp.opengl.GL2 gl, String texname, int texid, int texunit) voidbindTextureRECT(com.jogamp.opengl.GL2 gl, String texname, int texid, int texunit) protected voidcheckShaderLogInfo(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.StrictnessvoidcompileFragmentShader(com.jogamp.opengl.GL2 gl, URL infoURL, String content) voidcompileVertexShader(com.jogamp.opengl.GL2 gl, URL infoURL, String content) voiddestroy(com.jogamp.opengl.GL2 gl) voidlink(com.jogamp.opengl.GL2 gl) voidlink(com.jogamp.opengl.GL2 gl, boolean validateImmediatly) Create a program and attach previously loaded and compiled shaders.voidloadAndCompileFragmentShader(com.jogamp.opengl.GL2 gl, InputStream stream) voidloadAndCompileFragmentShader(com.jogamp.opengl.GL2 gl, InputStream stream, URL infoURL) voidloadAndCompileFragmentShader(com.jogamp.opengl.GL2 gl, URL fileURL) voidloadAndCompileShaders(com.jogamp.opengl.GL2 gl, ShaderFilePair files) voidloadAndCompileVertexShader(com.jogamp.opengl.GL2 gl, InputStream stream) voidloadAndCompileVertexShader(com.jogamp.opengl.GL2 gl, InputStream stream, URL infoURL) voidloadAndCompileVertexShader(com.jogamp.opengl.GL2 gl, URL fileURL) readErrors(com.jogamp.opengl.GL2 gl, int iID) voidsetTextureUnit(com.jogamp.opengl.GL2 gl, String texname, int texunit) voidsetUniform(com.jogamp.opengl.GL2 gl, String name, float value) voidsetUniform(com.jogamp.opengl.GL2 gl, String name, float[] values, int count) voidunbind(com.jogamp.opengl.GL2 gl) voidvalidateProgram(com.jogamp.opengl.GL2 gl) voidverifyLinkStatus(com.jogamp.opengl.GL2 gl, int programId) voidverifyShaderCompiled(com.jogamp.opengl.GL2 gl, URL fileURL, int programId, String content) protected voidwarn(String info, GLSLProgram.GLSLWarnType type) protected voidprotected voidwarnScript(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
-