|
Aviatrix3D 2.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.Shader
org.j3d.aviatrix3d.GLSLangShader
public class 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, LISTENER_SET_TIMING_ERR_PROP, updateHandler |
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. |
ComponentRenderable |
getArgumentsRenderable()
Get an object that represents arguments that should be passed along with the shader. |
ShaderArguments |
getShaderArguments()
Get the currently set shader arguments instance. |
ShaderProgram |
getShaderProgram()
Get the currently set shader program instance. |
ShaderComponentRenderable |
getShaderRenderable(int type)
Get the component of this shader, if it has one. |
boolean |
isValidated()
Check on the current validation state. |
void |
postRender(javax.media.opengl.GL gl)
Restore all openGL state to the given drawable |
void |
render(javax.media.opengl.GL gl)
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, 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 GLSLangShader()
Method Detail |
---|
public ComponentRenderable getArgumentsRenderable()
getArgumentsRenderable
in interface ShaderRenderable
public ShaderComponentRenderable getShaderRenderable(int type)
getShaderRenderable
in interface ShaderRenderable
type
- One of the _SHADER constants from
ShaderComponentRenderable
public 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 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 setShaderProgram(ShaderProgram prog) throws InvalidWriteTimingException
prog
- The program instance to use or null
InvalidWriteTimingException
- An attempt was made to write outside
of the NodeUpdateListener data changed 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 data changed 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 data changed callback methodpublic boolean isValidated()
public int compareTo(GLSLangShader sh)
sh
- The shader instances to be compared
public boolean equals(GLSLangShader sh)
sh
- The shader instance to be compared
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |