Package com.jogamp.opengl.util.glsl
Class ShaderProgram
java.lang.Object
com.jogamp.opengl.util.glsl.ShaderProgram
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(GL2ES2 gl, ShaderCode shaderCode, PrintStream verboseOut) Adds a new shader to a this non running program.voidadd(ShaderCode shaderCode) Adds a new shader to this program.booleancontains(ShaderCode shaderCode) voidDetaches all shader codes and deletes the program.booleangetShader(int id) Warning slow O(n) operation ..inthashCode()intid()returns the uniq shader id as an integerfinal booleanCreates the empty GL program object usingGL2ES2.glCreateProgram(), if not already created.booleaninUse()booleanlink(GL2ES2 gl, PrintStream verboseOut) Links the shader code to the program.booleanlinked()voidintprogram()Returns the shader program name, which is non zero if valid.voidDetaches all shader codes and deletes the program, but leaves the shader code intact.voidDetaches all shader codes and deletes the program.booleanreplaceShader(GL2ES2 gl, ShaderCode oldShader, ShaderCode newShader, PrintStream verboseOut) Replace a shader in a program and re-links the program.toString()voiduseProgram(GL2ES2 gl, boolean on) booleanvalidateProgram(GL2ES2 gl, PrintStream verboseOut)
-
Constructor Details
-
ShaderProgram
public ShaderProgram()
-
-
Method Details
-
linked
public boolean linked() -
inUse
public boolean inUse() -
program
public int program()Returns the shader program name, which is non zero if valid. -
id
public int id()returns the uniq shader id as an integer -
destroy
Detaches all shader codes and deletes the program. Destroys the shader codes as well. Calls release(gl, true)- See Also:
-
release
Detaches all shader codes and deletes the program, but leaves the shader code intact. Calls release(gl, false)- See Also:
-
release
Detaches all shader codes and deletes the program. IfdestroyShaderCodeis true it destroys the shader codes as well. -
add
Adds a new shader to this program.This command does not compile and attach the shader, use
#add(GL2ES2, ShaderCode)for this purpose.- Throws:
GLException
-
contains
-
getShader
Warning slow O(n) operation ..- Parameters:
id-- Returns:
-
init
Creates the empty GL program object usingGL2ES2.glCreateProgram(), if not already created.- Parameters:
gl-- Returns:
- true if shader program is valid, i.e. not zero
-
add
Adds a new shader to a this non running program.Compiles and attaches the shader, if not done yet.
- Returns:
- true if the shader was successfully added, false if compilation failed.
-
replaceShader
public boolean replaceShader(GL2ES2 gl, ShaderCode oldShader, ShaderCode newShader, PrintStream verboseOut) Replace a shader in a program and re-links the program.- Parameters:
gl-oldShader- the to be replace ShadernewShader- the new ShaderCodeverboseOut- the optional verbose output stream- Returns:
- true if all steps are valid, shader compilation, attachment and linking; otherwise false.
- See Also:
-
ShaderState#glEnableVertexAttribArrayShaderState#glDisableVertexAttribArrayShaderState#glVertexAttribPointerShaderState#getVertexAttribPointerShaderState#glReleaseAllVertexAttributesShaderState#glResetAllVertexAttributesShaderState#glResetAllVertexAttributesShaderState#glResetAllVertexAttributes
-
link
Links the shader code to the program.Compiles and attaches the shader code to the program if not done by yet
Within this process, all GL resources (shader and program objects) are created if necessary.
- Parameters:
gl-verboseOut-- Returns:
- true if program was successfully linked and is valid, otherwise false
- See Also:
-
equals
-
hashCode
public int hashCode() -
toString
-
toString
-
validateProgram
-
useProgram
-
notifyNotInUse
public void notifyNotInUse()
-