Package javax.media.j3d
Class CgShaderProgram
- java.lang.Object
-
- javax.media.j3d.SceneGraphObject
-
- javax.media.j3d.NodeComponent
-
- javax.media.j3d.ShaderProgram
-
- javax.media.j3d.CgShaderProgram
-
public class CgShaderProgram extends ShaderProgram
The CgShaderProgram object is a concrete implementation of a ShaderProgram node component for NVIDIA's Cg shader language.- Since:
- Java 3D 1.4
- See Also:
SourceCodeShader
-
-
Field Summary
-
Fields inherited from class javax.media.j3d.ShaderProgram
ALLOW_NAMES_READ, ALLOW_SHADERS_READ
-
-
Constructor Summary
Constructors Constructor Description CgShaderProgram()
Constructs a Cg shader program node component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String[]
getShaderAttrNames()
Retrieves the shader attribute names array from this ShaderProgram object.Shader[]
getShaders()
Retrieves the array of shaders from this shader program.java.lang.String[]
getVertexAttrNames()
Retrieves the vertex attribute names array from this ShaderProgram object.void
setShaderAttrNames(java.lang.String[] shaderAttrNames)
Sets the shader attribute names array for this ShaderProgram object.void
setShaders(Shader[] shaders)
Copies the specified array of shaders into this shader program.void
setVertexAttrNames(java.lang.String[] vertexAttrNames)
Sets the vertex attribute names array for this ShaderProgram object.-
Methods inherited from class javax.media.j3d.NodeComponent
cloneNodeComponent, cloneNodeComponent, duplicateNodeComponent, duplicateNodeComponent, getDuplicateOnCloneTree, setDuplicateOnCloneTree
-
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
-
-
-
-
Method Detail
-
setVertexAttrNames
public void setVertexAttrNames(java.lang.String[] vertexAttrNames)
Description copied from class:ShaderProgram
Sets the vertex attribute names array for this ShaderProgram object. Each element in the array specifies the shader attribute name that is bound to the corresponding numbered vertex attribute within a GeometryArray object that uses this shader program. Array element 0 specifies the name of GeometryArray vertex attribute 0, array element 1 specifies the name of GeometryArray vertex attribute 1, and so forth. The array of names may be null or empty (0 length), but the elements of the array must be non-null.- Specified by:
setVertexAttrNames
in classShaderProgram
- Parameters:
vertexAttrNames
- array of vertex attribute names for this shader program. A copy of this array is made.
-
getVertexAttrNames
public java.lang.String[] getVertexAttrNames()
Description copied from class:ShaderProgram
Retrieves the vertex attribute names array from this ShaderProgram object.- Specified by:
getVertexAttrNames
in classShaderProgram
- Returns:
- a copy of this ShaderProgram's array of vertex attribute names.
-
setShaderAttrNames
public void setShaderAttrNames(java.lang.String[] shaderAttrNames)
Description copied from class:ShaderProgram
Sets the shader attribute names array for this ShaderProgram object. Each element in the array specifies a shader attribute name that may be set via a ShaderAttribute object. Only those attributes whose names that appear in the shader attribute names array can be set for a given shader program. The array of names may be null or empty (0 length), but the elements of the array must be non-null.TODO: finish this.
- Specified by:
setShaderAttrNames
in classShaderProgram
- Parameters:
shaderAttrNames
- array of shader attribute names for this shader program. A copy of this array is made.
-
getShaderAttrNames
public java.lang.String[] getShaderAttrNames()
Description copied from class:ShaderProgram
Retrieves the shader attribute names array from this ShaderProgram object.- Specified by:
getShaderAttrNames
in classShaderProgram
- Returns:
- a copy of this ShaderProgram's array of shader attribute names.
-
setShaders
public void setShaders(Shader[] shaders)
Copies the specified array of shaders into this shader program. This method makes a shallow copy of the array. The array of shaders may be null or empty (0 length), but the elements of the array must be non-null. The shading language of each shader in the array must beSHADING_LANGUAGE_CG
. Each shader in the array must be a SourceCodeShader. There must be no more than one vertex shader and one fragment shader in the array.- Specified by:
setShaders
in classShaderProgram
- Parameters:
shaders
- array of Shader objects to be copied into this ShaderProgram- Throws:
CapabilityNotSetException
- if appropriate capability is not set and this object is part of live or compiled scene graphjava.lang.IllegalArgumentException
- if the shading language of any shader in the shaders array is notSHADING_LANGUAGE_CG
.java.lang.IllegalArgumentException
- if there are more than one vertex shader or more than one fragment shader in the shaders array.java.lang.ClassCastException
- if any shader in the shaders array is not a SourceCodeShader.
-
getShaders
public Shader[] getShaders()
Description copied from class:ShaderProgram
Retrieves the array of shaders from this shader program. A shallow copy of the array is returned. The return value may be null.- Specified by:
getShaders
in classShaderProgram
- Returns:
- a copy of this ShaderProgram's array of Shader objects
-
-