|
j3d.org Aviatrix3D | ||||||||||
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.Shader
org.j3d.aviatrix3d.GLSLangShader
Shader handler for shaders written with the OpenGL GLSLang 1.0 shader language.
A shader consists of the compiled program source and a set of arguments. The
compiled source is represented by the ShaderProgram
class. Uniform
variable arguments are provided through the ShaderArguments
class,
while attribute variable values are directly provided as part of the
VertexGeometry
.
This allows a single program to be used multiple times and just change the argument values depending on the object to be rendered, without needing two completely separate sets of shaders.
Field Summary |
Fields inherited from class org.j3d.aviatrix3d.NodeComponent |
lastParent, liveCount, parentList |
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject |
alive, updateHandler, WRITE_TIMING_MSG |
Constructor Summary | |
GLSLangShader()
Constructs a shader with nothing set. |
Method Summary | |
int |
compareTo(GLSLangShader 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(GLSLangShader 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. |
ShaderArguments |
getShaderArguments()
Get the currently set shader arguments instance. |
ShaderProgram |
getShaderProgram()
Get the currently set shader program instance. |
boolean |
isValidated()
Check on the current validation state. |
void |
postRender(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Restore all openGL state to the given drawable |
void |
render(net.java.games.jogl.GL gl,
net.java.games.jogl.GLU glu)
Issue ogl commands needed for this component |
protected void |
setLive(boolean state)
Notification that this object is live now. |
void |
setShaderArguments(ShaderArguments arg)
Set the shader arguments to be used on this object. |
void |
setShaderProgram(ShaderProgram prog)
Set the shader program to be used on this object. |
protected void |
setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. |
void |
validate()
Request that the shader validate it's code at the next available oppourtunity. |
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 GLSLangShader()
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 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 setShaderProgram(ShaderProgram prog) throws InvalidWriteTimingException
prog
- The program instance to use or null
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic ShaderProgram getShaderProgram()
public void setShaderArguments(ShaderArguments arg) throws InvalidWriteTimingException
arg
- The argument instance to use or null
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic ShaderArguments getShaderArguments()
public void validate() throws InvalidWriteTimingException
Also note that the validation can only take place in the course of the normal runtime processing of the render loop as it validates whether the shader can execute given the current complete OpenGL state. If the shader is currently on a primitive that is not visible on screen, it will not be validated until it is visible.
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener callback methodpublic boolean isValidated()
public int compareTo(GLSLangShader sh)
Derived classes should extend this one to add the extra comparisons needed.
sh
- The shader instances to be compared
public boolean equals(GLSLangShader sh)
sh
- The shader instance to be compared
|
j3d.org Aviatrix3D | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |