Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class GL14ShaderProgram

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.GL14ShaderProgram
All Implemented Interfaces:
java.lang.Comparable, ObjectRenderable, Renderable, ShaderComponentRenderable
Direct Known Subclasses:
FragmentShader, VertexShader

public abstract class GL14ShaderProgram
extends NodeComponent
implements ShaderComponentRenderable

Base class representing a single shader program that can be applied to the rendering pipeline.

Version:
$Revision: 1.10 $
Author:
Justin Couch

Field Summary
protected  boolean programChanged
          Flag to say that the string has changed and should be recompiled
protected  java.util.HashMap<javax.media.opengl.GL,java.lang.Integer> programIdMap
          Mapping of GL context to shader program ID
protected  java.lang.String programString
          The program string that is stored as the shader
 
Fields inherited from class org.j3d.aviatrix3d.NodeComponent
lastParent, liveCount, parentList
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
Fields inherited from interface org.j3d.aviatrix3d.rendering.ShaderComponentRenderable
FRAGMENT_SHADER, GEOMETRY_SHADER, PROGRAM_SHADER, VERTEX_SHADER
 
Constructor Summary
GL14ShaderProgram()
          Constructs a Shader with default values.
 
Method Summary
 int getProgramId(javax.media.opengl.GL gl)
          Fetch the ID handle for this program for the given context.
 java.lang.String getProgramString()
          Get the currently set program string.
 boolean isValid(javax.media.opengl.GL gl)
          Check to see if this is linked for the given GL context.
 void reinitialize(javax.media.opengl.GL gl)
          Re-initialise this shader because the underlying GL context has changed.
 void setProgramString(java.lang.String str)
          Set the program string that is to be registered by this shader.
 
Methods inherited from class org.j3d.aviatrix3d.NodeComponent
addParent, getParents, numParents, removeParent
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, checkForCyclicParent, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.ShaderComponentRenderable
getComponentType
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.ObjectRenderable
postRender, render
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable
equals
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

programString

protected java.lang.String programString
The program string that is stored as the shader


programChanged

protected boolean programChanged
Flag to say that the string has changed and should be recompiled


programIdMap

protected java.util.HashMap<javax.media.opengl.GL,java.lang.Integer> programIdMap
Mapping of GL context to shader program ID

Constructor Detail

GL14ShaderProgram

public GL14ShaderProgram()
Constructs a Shader with default values.

Method Detail

isValid

public boolean isValid(javax.media.opengl.GL gl)
Check to see if this is linked for the given GL context. This tests to see if a valid program ID has already been assigned, indicating that at least an internal link(gl) call has been made.

Specified by:
isValid in interface ShaderComponentRenderable
Parameters:
gl - The GL context to test for linkage against
Returns:
true if there is a valid ID to work with

getProgramId

public int getProgramId(javax.media.opengl.GL gl)
Fetch the ID handle for this program for the given context.

Specified by:
getProgramId in interface ShaderComponentRenderable
Parameters:
gl - The GL context to get the ID for
Returns:
The ID value or 0 if none

reinitialize

public void reinitialize(javax.media.opengl.GL gl)
Re-initialise this shader because the underlying GL context has changed. This should also reinitialise any resources that it is dependent on.

Specified by:
reinitialize in interface ShaderComponentRenderable
Parameters:
gl - The GL context to reinitialise with

setProgramString

public void setProgramString(java.lang.String str)
                      throws InvalidWriteTimingException
Set the program string that is to be registered by this shader. Setting a value of null will clear the current shader and prevent it from being rendered next frame.

Parameters:
str - The new program string to be registered or null
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getProgramString

public java.lang.String getProgramString()
Get the currently set program string. If none is set, return null.

Returns:
The current string or null

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org