|
Aviatrix3D 1.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j3d.aviatrix3d.SceneGraphObject
org.j3d.aviatrix3d.NodeComponent
org.j3d.aviatrix3d.ShaderProgram
Representation of a complete GLSLang shader program.
The behaviour of this object mirrors that of the OpenGL specification. To create a program, you have to collect a number of objects, have them compiled, then assemble and link the objects into a single application. In addition, any runtime structural changes to the program will not take effect until the next time that the program is (re)linked.
A program is separate from the arguments that can be passed to it. This
class represents the raw shader program that can be called upon to do some
processing work. Vertex attribute values are set through the calls in the
VertexGeometry
class. Uniform values are defined by the accompanying
ShaderArguments
class. This allows a single instance of this program
to be created, yet used in different parts of the scene graph with different
settings (eg a marble shader that has different colour combos).
Field Summary |
Fields inherited from class org.j3d.aviatrix3d.NodeComponent |
lastParent, liveCount, parentList |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
alive, LISTENER_SET_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG |
Constructor Summary | |
ShaderProgram()
Constructs a Shader program with nothing set. |
Method Summary | |
void |
addShaderObject(ShaderObject obj)
Add a shader object to this program. |
void |
bindAttributeName(java.lang.String name,
int index)
Bind the given attribute name to a specific index. |
void |
cleanup(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Cleanup the object now for the given GL context. |
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
int |
compareTo(ShaderProgram sh)
Compares this object with the specified object for order. |
boolean |
equals(java.lang.Object o)
Compare this object for equality to the given object. |
boolean |
equals(ShaderProgram sh)
Compares this object with the specified object to check for equivalence. |
void |
fetchLogInfo(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
The user requested log information about the shader object, so now is the time to fetch it. |
java.lang.String |
getLastInfoLog()
Get the last fetched information log from this shader. |
int |
getNumShaderObjects()
Get the number of currently registered shader objects. |
int |
getProgramId(net.java.games.jogl.GL gl)
Fetch the ID handle for this program for the given context. |
void |
getShaderObjects(ShaderObject[] objects)
Get the current shader objects. |
void |
initialize(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Link this shader now. |
boolean |
isLinkConfirmed()
Check to see the current state of whether compilation should be confirmed. |
boolean |
isValid(net.java.games.jogl.GL gl)
Check to see if this is linked for the given GL context. |
void |
link()
Request that the shader link at the next available oppourtunity. |
void |
postRender(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Restore all openGL state to the given drawable |
void |
removeShaderObject(ShaderObject obj)
Remove the shader object from this program. |
void |
render(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Issue ogl commands needed for this component |
void |
requestInfoLog()
Request that the shader fetch the last run log of this program. |
void |
requestLinkConfirmation(boolean enable)
Have the class confirm whether or not the source successfully compiled. |
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. |
Methods inherited from class org.j3d.aviatrix3d.NodeComponent |
addParent, getParents, hasChanged, numParents, removeParent |
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject |
checkForCyclicChild, checkForCyclicParent, dataChanged, getUserData, isLive, setUserData |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ShaderProgram()
Method Detail |
protected void setUpdateHandler(NodeUpdateHandler handler)
setUpdateHandler
in class SceneGraphObject
handler
- The instance to use as a handlerprotected void setLive(boolean state)
setLive
in class SceneGraphObject
state
- true if this should be marked as live nowpublic void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
render
in interface RenderableObject
gl
- The gl context to draw withglu
- The utility context to draw withpublic void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
postRender
in interface RenderableObject
gl
- The gl context to draw withglu
- The utility context to draw withpublic void initialize(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
initialize
in interface ShaderSceneGraphObject
gl
- The GL context to use to compile the code withglu
- The utility context to draw withpublic void fetchLogInfo(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
fetchLogInfo
in interface ShaderSceneGraphObject
gl
- The gl context to draw withglu
- The utility context to draw withpublic void cleanup(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
cleanup
in interface DeletableSceneGraphObject
gl
- The gl context to draw withglu
- The utility context to draw withpublic int compareTo(java.lang.Object o) throws java.lang.ClassCastException
Derived classes should extend this one to add the extra comparisons needed.
compareTo
in interface java.lang.Comparable
o
- The objec to be compared
java.lang.ClassCastException
- The specified object's type prevents it from
being compared to this Objectpublic boolean equals(java.lang.Object o)
o
- The object to be compared
public void addShaderObject(ShaderObject obj) throws InvalidWriteTimingException
obj
- The object instance to add
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic void removeShaderObject(ShaderObject obj) throws InvalidWriteTimingException
obj
- The object instance to remove
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic int getNumShaderObjects()
public void getShaderObjects(ShaderObject[] objects)
getNumShaderObjects()
in length.
objects
- An array to copy values intopublic void link() throws InvalidWriteTimingException
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic void requestInfoLog() throws InvalidWriteTimingException
InvalidWriteTimingException
- An attempt was made to request this
outside of the updateSceneGraph() callpublic java.lang.String getLastInfoLog()
public void bindAttributeName(java.lang.String name, int index) throws InvalidWriteTimingException
setAttributes()
methods of
VertexGeometry
. Note that, in accordance with the rules of
OpenGL, this binding will not take place until the next link() call.
name
- The attribute name to bind the index toindex
- The index value for the attrib name to correspond to the
vertex attribute values
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic void requestLinkConfirmation(boolean enable) throws InvalidWriteTimingException
enable
- true if the code should confirm compilation succeeds
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic boolean isLinkConfirmed()
public boolean isValid(net.java.games.jogl.GL gl)
gl
- The GL context to test for linkage against
public int getProgramId(net.java.games.jogl.GL gl)
gl
- The GL context to get the ID for
public int compareTo(ShaderProgram sh)
Derived classes should extend this one to add the extra comparisons needed.
sh
- The program instance to be compared
public boolean equals(ShaderProgram sh)
sh
- The program instance to be compared
|
Aviatrix3D 1.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |