JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.glsl.ShaderProgram Class Reference
Collaboration diagram for com.jogamp.opengl.util.glsl.ShaderProgram:

Public Member Functions

 ShaderProgram ()
 
boolean linked ()
 
boolean inUse ()
 
int program ()
 Returns the shader program name, which is non zero if valid. More...
 
int id ()
 returns the uniq shader id as an integer More...
 
synchronized void destroy (final GL2ES2 gl)
 Detaches all shader codes and deletes the program. More...
 
synchronized void release (final GL2ES2 gl)
 Detaches all shader codes and deletes the program, but leaves the shader code intact. More...
 
synchronized void release (final GL2ES2 gl, final boolean destroyShaderCode)
 Detaches all shader codes and deletes the program. More...
 
synchronized void add (final ShaderCode shaderCode) throws GLException
 Adds a new shader to this program. More...
 
synchronized boolean contains (final ShaderCode shaderCode)
 
synchronized ShaderCode getShader (final int id)
 Warning slow O(n) operation . More...
 
synchronized final boolean init (final GL2ES2 gl)
 Creates the empty GL program object using GL2ES2#glCreateProgram(), if not already created. More...
 
synchronized boolean add (final GL2ES2 gl, final ShaderCode shaderCode, final PrintStream verboseOut)
 Adds a new shader to a this non running program. More...
 
synchronized boolean replaceShader (final GL2ES2 gl, final ShaderCode oldShader, final ShaderCode newShader, final PrintStream verboseOut)
 Replace a shader in a program and re-links the program. More...
 
synchronized boolean link (final GL2ES2 gl, final PrintStream verboseOut)
 Links the shader code to the program. More...
 
boolean equals (final Object obj)
 
int hashCode ()
 
StringBuilder toString (StringBuilder sb)
 
String toString ()
 
synchronized boolean validateProgram (final GL2ES2 gl, final PrintStream verboseOut)
 Performs GL2ES2#glValidateProgram(int) via ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream). More...
 
synchronized void useProgram (final GL2ES2 gl, boolean on)
 
synchronized void notifyNotInUse ()
 
void dumpSource (final PrintStream out)
 

Detailed Description

Definition at line 39 of file ShaderProgram.java.

Constructor & Destructor Documentation

◆ ShaderProgram()

com.jogamp.opengl.util.glsl.ShaderProgram.ShaderProgram ( )

Definition at line 41 of file ShaderProgram.java.

Here is the caller graph for this function:

Member Function Documentation

◆ add() [1/2]

synchronized boolean com.jogamp.opengl.util.glsl.ShaderProgram.add ( final GL2ES2  gl,
final ShaderCode  shaderCode,
final PrintStream  verboseOut 
)

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.

Definition at line 167 of file ShaderProgram.java.

Here is the call graph for this function:

◆ add() [2/2]

synchronized void com.jogamp.opengl.util.glsl.ShaderProgram.add ( final ShaderCode  shaderCode) throws GLException

Adds a new shader to this program.

This command does not compile and attach the shader, use add(GL2ES2, ShaderCode) for this purpose.

Definition at line 119 of file ShaderProgram.java.

Here is the caller graph for this function:

◆ contains()

synchronized boolean com.jogamp.opengl.util.glsl.ShaderProgram.contains ( final ShaderCode  shaderCode)

Definition at line 123 of file ShaderProgram.java.

◆ destroy()

synchronized void com.jogamp.opengl.util.glsl.ShaderProgram.destroy ( final GL2ES2  gl)

Detaches all shader codes and deletes the program.

Destroys the shader codes as well. Calls release(gl, true)

See also
release(GL2ES2, boolean)

Definition at line 68 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpSource()

void com.jogamp.opengl.util.glsl.ShaderProgram.dumpSource ( final PrintStream  out)

Definition at line 327 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

boolean com.jogamp.opengl.util.glsl.ShaderProgram.equals ( final Object  obj)

Definition at line 268 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getShader()

synchronized ShaderCode com.jogamp.opengl.util.glsl.ShaderProgram.getShader ( final int  id)

Warning slow O(n) operation .

Parameters
id
Returns

Definition at line 132 of file ShaderProgram.java.

◆ hashCode()

int com.jogamp.opengl.util.glsl.ShaderProgram.hashCode ( )

Definition at line 277 of file ShaderProgram.java.

◆ id()

int com.jogamp.opengl.util.glsl.ShaderProgram.id ( )

returns the uniq shader id as an integer

Definition at line 59 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

synchronized final boolean com.jogamp.opengl.util.glsl.ShaderProgram.init ( final GL2ES2  gl)

Creates the empty GL program object using GL2ES2#glCreateProgram(), if not already created.

Parameters
gl
Returns
true if shader program is valid, i.e. not zero

Definition at line 153 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inUse()

boolean com.jogamp.opengl.util.glsl.ShaderProgram.inUse ( )

Definition at line 49 of file ShaderProgram.java.

Here is the caller graph for this function:

◆ link()

synchronized boolean com.jogamp.opengl.util.glsl.ShaderProgram.link ( final GL2ES2  gl,
final PrintStream  verboseOut 
)

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
init(GL2ES2)

Definition at line 242 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ linked()

boolean com.jogamp.opengl.util.glsl.ShaderProgram.linked ( )

Definition at line 45 of file ShaderProgram.java.

Here is the caller graph for this function:

◆ notifyNotInUse()

synchronized void com.jogamp.opengl.util.glsl.ShaderProgram.notifyNotInUse ( )

Definition at line 323 of file ShaderProgram.java.

Here is the caller graph for this function:

◆ program()

int com.jogamp.opengl.util.glsl.ShaderProgram.program ( )

Returns the shader program name, which is non zero if valid.

Definition at line 54 of file ShaderProgram.java.

Here is the caller graph for this function:

◆ release() [1/2]

synchronized void com.jogamp.opengl.util.glsl.ShaderProgram.release ( final GL2ES2  gl)

Detaches all shader codes and deletes the program, but leaves the shader code intact.

Calls release(gl, false)

See also
release(GL2ES2, boolean)

Definition at line 79 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ release() [2/2]

synchronized void com.jogamp.opengl.util.glsl.ShaderProgram.release ( final GL2ES2  gl,
final boolean  destroyShaderCode 
)

Detaches all shader codes and deletes the program.

If destroyShaderCode is true it destroys the shader codes as well.

Definition at line 87 of file ShaderProgram.java.

Here is the call graph for this function:

◆ replaceShader()

synchronized boolean com.jogamp.opengl.util.glsl.ShaderProgram.replaceShader ( final GL2ES2  gl,
final ShaderCode  oldShader,
final ShaderCode  newShader,
final PrintStream  verboseOut 
)

Replace a shader in a program and re-links the program.

Parameters
gl
oldShaderthe to be replace Shader
newShaderthe new ShaderCode
verboseOutthe optional verbose output stream
Returns
true if all steps are valid, shader compilation, attachment and linking; otherwise false.
See also
ShaderState::glEnableVertexAttribArray
ShaderState::glDisableVertexAttribArray
ShaderState::glVertexAttribPointer
ShaderState::getVertexAttribPointer
ShaderState::glReleaseAllVertexAttributes
ShaderState::glResetAllVertexAttributes
ShaderState::glResetAllVertexAttributes
ShaderState::glResetAllVertexAttributes

Definition at line 199 of file ShaderProgram.java.

Here is the call graph for this function:

◆ toString() [1/2]

String com.jogamp.opengl.util.glsl.ShaderProgram.toString ( )

Definition at line 299 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString() [2/2]

StringBuilder com.jogamp.opengl.util.glsl.ShaderProgram.toString ( StringBuilder  sb)

Definition at line 281 of file ShaderProgram.java.

Here is the caller graph for this function:

◆ useProgram()

synchronized void com.jogamp.opengl.util.glsl.ShaderProgram.useProgram ( final GL2ES2  gl,
boolean  on 
)

Definition at line 311 of file ShaderProgram.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ validateProgram()

synchronized boolean com.jogamp.opengl.util.glsl.ShaderProgram.validateProgram ( final GL2ES2  gl,
final PrintStream  verboseOut 
)

Performs GL2ES2#glValidateProgram(int) via ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream).

See also
ShaderUtil::isProgramExecStatusValid(GL, int, PrintStream)

Definition at line 307 of file ShaderProgram.java.

Here is the call graph for this function:

The documentation for this class was generated from the following file: