|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.aviatrix3d.SceneGraphObject org.j3d.aviatrix3d.NodeComponent org.j3d.aviatrix3d.ShaderProgram
public class 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_TIMING_ERR_PROP, updateHandler |
Fields inherited from interface org.j3d.aviatrix3d.rendering.ShaderComponentRenderable |
---|
FRAGMENT_SHADER, GEOMETRY_SHADER, PROGRAM_SHADER, VERTEX_SHADER |
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(javax.media.opengl.GL gl)
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(javax.media.opengl.GL gl)
The user requested log information about the shader object, so now is the time to fetch it. |
int |
getComponentType()
Get the type of component this state represents. |
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(javax.media.opengl.GL gl)
Fetch the ID handle for this program for the given context. |
void |
getShaderObjects(ShaderObject[] objects)
Get the current shader objects. |
void |
initialize(javax.media.opengl.GL gl)
Link this shader now. |
boolean |
isLinkConfirmed()
Check to see the current state of whether compilation should be confirmed. |
boolean |
isValid(javax.media.opengl.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(javax.media.opengl.GL gl)
Restore all openGL state to the given drawable |
void |
reinitialize(javax.media.opengl.GL gl)
Re-initialise this shader because the underlying GL context has changed. |
void |
removeShaderObject(ShaderObject obj)
Remove the shader object from this program. |
void |
render(javax.media.opengl.GL gl)
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, 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 |
---|
public ShaderProgram()
Method Detail |
---|
public int getComponentType()
getComponentType
in interface ShaderComponentRenderable
public boolean isValid(javax.media.opengl.GL gl)
isValid
in interface ShaderComponentRenderable
gl
- The GL context to test for linkage against
public int getProgramId(javax.media.opengl.GL gl)
getProgramId
in interface ShaderComponentRenderable
gl
- The GL context to get the ID for
public void reinitialize(javax.media.opengl.GL gl)
reinitialize
in interface ShaderComponentRenderable
gl
- The GL context to reinitialise withpublic void render(javax.media.opengl.GL gl)
render
in interface ObjectRenderable
gl
- The gl context to draw withpublic void postRender(javax.media.opengl.GL gl)
postRender
in interface ObjectRenderable
gl
- The gl context to draw withpublic void initialize(javax.media.opengl.GL gl)
initialize
in interface ShaderSourceRenderable
gl
- The GL context to use to compile the code withpublic void fetchLogInfo(javax.media.opengl.GL gl)
fetchLogInfo
in interface ShaderSourceRenderable
gl
- The gl context to draw withpublic void cleanup(javax.media.opengl.GL gl)
cleanup
in interface DeletableRenderable
gl
- The gl context to draw withprotected 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 int compareTo(java.lang.Object o) throws java.lang.ClassCastException
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)
equals
in interface Renderable
equals
in class java.lang.Object
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 data changed 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 data changed 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 data changed 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 data changed 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 data changed callback methodpublic boolean isLinkConfirmed()
public int compareTo(ShaderProgram sh)
sh
- The program instance to be compared
public boolean equals(ShaderProgram sh)
sh
- The program instance to be compared
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |