Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class GL14Shader

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.NodeComponent
          extended by org.j3d.aviatrix3d.Shader
              extended by org.j3d.aviatrix3d.GL14Shader
All Implemented Interfaces:
java.lang.Comparable, ObjectRenderable, Renderable, ShaderRenderable

public class GL14Shader
extends Shader
implements ShaderRenderable

Shader container object for the shaders usable with OpenGL 1.4 with the separate vertex and fragment shader code.

Version:
$Revision: 1.14 $
Author:
Justin Couch

Field Summary
 
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
 
Constructor Summary
GL14Shader()
          Constructs a Shader with default values.
 
Method Summary
 int compareTo(GL14Shader sh)
          Compares this object with the specified object for order.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean equals(GL14Shader sh)
          Compares this object with the specified object to check for equivalence.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 ComponentRenderable getArgumentsRenderable()
          Get an object that represents arguments that should be passed along with the shader.
 FragmentShader getFragmentShader()
          Get the current fragShader in use.
 ShaderComponentRenderable getShaderRenderable(int type)
          Get the component of this shader, if it has one.
 VertexShader getVertexShader()
          Get the current vertexShader in use.
 void postRender(javax.media.opengl.GL gl)
          Restore all openGL state.
 void render(javax.media.opengl.GL gl)
          Issue ogl commands needed for this component.
 void setFragmentShader(FragmentShader shader)
          Set the fragment shader to use.
protected  void setLive(boolean state)
          Notification that this object is live now.
protected  void setUpdateHandler(NodeUpdateHandler handler)
          Set the scenegraph update handler for this node.
 void setVertexShader(VertexShader shader)
          Set the vertexShader to use.
 
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, setUserData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GL14Shader

public GL14Shader()
Constructs a Shader with default values.

Method Detail

getArgumentsRenderable

public ComponentRenderable getArgumentsRenderable()
Get an object that represents arguments that should be passed along with the shader. If the shader has a full program component renderable. then it will most likely have arguments too.

Specified by:
getArgumentsRenderable in interface ShaderRenderable
Returns:
An object representing any global argument lists

getShaderRenderable

public ShaderComponentRenderable getShaderRenderable(int type)
Get the component of this shader, if it has one. If the given type is not recognised by this shader, return null.

Specified by:
getShaderRenderable in interface ShaderRenderable
Parameters:
type - One of the _SHADER constants from ShaderComponentRenderable
Returns:
A matching component or null if none

render

public void render(javax.media.opengl.GL gl)
Issue ogl commands needed for this component.

Specified by:
render in interface ObjectRenderable
Parameters:
gl - The gl context to draw with

postRender

public void postRender(javax.media.opengl.GL gl)
Restore all openGL state.

Specified by:
postRender in interface ObjectRenderable
Parameters:
gl - The gl context to draw with

setLive

protected void setLive(boolean state)
Notification that this object is live now. Overridden to make sure that the live state of the nodes represents the same state as the parent scene graph.

Overrides:
setLive in class SceneGraphObject
Parameters:
state - true if this should be marked as live now

setUpdateHandler

protected void setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Overrides:
setUpdateHandler in class SceneGraphObject
Parameters:
handler - The instance to use as a handler

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The object to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Specified by:
equals in interface Renderable
Overrides:
equals in class java.lang.Object
Parameters:
o - The object to be compared
Returns:
True if these represent the same values

setVertexShader

public void setVertexShader(VertexShader shader)
                     throws InvalidWriteTimingException
Set the vertexShader to use. null will clear the vertexShader

Parameters:
shader - The new shader instance to use or null
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getVertexShader

public VertexShader getVertexShader()
Get the current vertexShader in use.

Returns:
The current shader instance or null

setFragmentShader

public void setFragmentShader(FragmentShader shader)
                       throws InvalidWriteTimingException
Set the fragment shader to use. null will clear the shader.

Parameters:
shader - The new shader instance to use or null
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

getFragmentShader

public FragmentShader getFragmentShader()
Get the current fragShader in use.

Returns:
The current shader instance or null

compareTo

public int compareTo(GL14Shader sh)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
sh - The shader instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(GL14Shader sh)
Compares this object with the specified object to check for equivalence.

Parameters:
sh - The shader instance to be compared
Returns:
true if the objects represent identical values

Aviatrix3D
2.1.0

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