com.sun.opengl.util.glsl
Class ShaderProgram

java.lang.Object
  extended by com.sun.opengl.util.glsl.ShaderProgram

public class ShaderProgram
extends Object


Field Summary
protected  Integer id
           
protected static int nextID
           
protected  boolean programInUse
           
protected  boolean programLinked
           
protected  HashMap shaderMap
           
protected  int shaderProgram
           
 
Constructor Summary
ShaderProgram()
           
 
Method Summary
 boolean add(ShaderCode shaderCode)
          Adds a new shader to a this non running program.
 void destroy(GL2ES2 gl)
          Detaches all shader codes and deletes the program.
 boolean equals(Object obj)
           
 ShaderCode getShader(int id)
           
 boolean glReplaceShader(GL2ES2 gl, int oldShaderID, ShaderCode newShader, PrintStream verboseOut)
          Replace a shader in a 'running' program.
protected  void glUseProgram(GL2ES2 gl, boolean on)
           
 int hashCode()
           
 int id()
          returns the uniq shader id as an integer
 boolean inUse()
           
 Integer key()
          returns the uniq shader id as an Integer
 boolean link(GL2ES2 gl, PrintStream verboseOut)
           
 boolean linked()
           
 int program()
           
 void release(GL2ES2 gl)
          Detaches all shader codes and deletes the program.
 void release(GL2ES2 gl, boolean releaseShaderToo)
          Detaches all shader codes and deletes the program.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

programLinked

protected boolean programLinked

programInUse

protected boolean programInUse

shaderProgram

protected int shaderProgram

shaderMap

protected HashMap shaderMap

id

protected Integer id

nextID

protected static int nextID
Constructor Detail

ShaderProgram

public ShaderProgram()
Method Detail

linked

public boolean linked()

inUse

public boolean inUse()

program

public int program()

id

public int id()
returns the uniq shader id as an integer

See Also:
key()

key

public Integer key()
returns the uniq shader id as an Integer

See Also:
id()

destroy

public void destroy(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)

release

public void release(GL2ES2 gl)
Detaches all shader codes and deletes the program. Calls release(gl, false)

See Also:
release(GL2ES2, boolean)

release

public void release(GL2ES2 gl,
                    boolean releaseShaderToo)
Detaches all shader codes and deletes the program. If releaseShaderToo is true, destroys the shader codes as well.


add

public boolean add(ShaderCode shaderCode)
Adds a new shader to a this non running program.

Returns:
false if the program is in use, or the shader already exist, otherwise true.

getShader

public ShaderCode getShader(int id)

glReplaceShader

public boolean glReplaceShader(GL2ES2 gl,
                               int oldShaderID,
                               ShaderCode newShader,
                               PrintStream verboseOut)
Replace a shader in a 'running' program. Refetches all previously bin/get attribute names and resets all attribute data as well

Parameters:
gl -
oldShaderID - the to be replace Shader
newShader - the new ShaderCode
verboseOut - the optional verbose outputstream
Throws:
GLException - is the program is not linked
See Also:
getAttribLocation, #glRefetchAttribLocations, #glResetAllVertexAttributes, glReplaceShader(javax.media.opengl.GL2ES2, int, com.sun.opengl.util.glsl.ShaderCode, java.io.PrintStream)

link

public boolean link(GL2ES2 gl,
                    PrintStream verboseOut)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

glUseProgram

protected void glUseProgram(GL2ES2 gl,
                            boolean on)


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.