Shader program property node. More...
#include <Inventor/nodes/SoShaderProgram.h>
Public Types | |
enum | GeometryInputType { POINTS_INPUT = GL_POINTS , LINES_INPUT = GL_LINES , TRIANGLES_INPUT = GL_TRIANGLES } |
Geometry input type. More... | |
enum | GeometryOutputType { POINTS_OUTPUT = GL_POINTS , LINE_STRIP_OUTPUT = GL_LINE_STRIP , TRIANGLE_STRIP_OUTPUT = GL_TRIANGLE_STRIP } |
Geometry ouput type. More... | |
Public Member Functions | |
virtual SoType | getTypeId () const |
Returns the type identifier for this specific instance. | |
SoShaderProgram () | |
Constructor. | |
SoFragmentShader * | getFragmentShader (int pos) const |
Returns the fragment shader at the specified position. | |
SoVertexShader * | getVertexShader (int pos) const |
Returns the vertex shader at the specified position. | |
SoGeometryShader * | getGeometryShader (int pos) const |
Returns the geometry shader at the specified position. | |
virtual SoFragmentShader * | setFragmentShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME) |
Convenience method to create a fragment shader with the specified filename and add it at the specified position. | |
virtual SoVertexShader * | setVertexShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME) |
Convenience method to create a vertex shader with the specified filename and add it at the specified position. | |
virtual SoGeometryShader * | setGeometryShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME) |
Convenience method to create a geometry shader with the specified filename and add it at the specified position. | |
virtual SoComputeShader * | setComputeShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME) |
Convenience method to create a compute shader with the specified filename and add it at the specified position. | |
SoTessellationControlShader * | getTessellationControlShader (int pos) const |
Returns the tessellation control shader at the specified position. | |
SoTessellationEvaluationShader * | getTessellationEvaluationShader (int pos) const |
Returns the tessellation evaluation shader at the specified position. | |
virtual SoTessellationControlShader * | setTessellationControlShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME) |
Convenience method to create a tessellation control shader with the specified filename and add it at the specified position. | |
virtual SoTessellationEvaluationShader * | setTessellationEvaluationShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME) |
Convenience method to create a tessellation evaluation shader with the specified filename and add it at the specified position. | |
SoShaderParameterImage * | addShaderParameterImage (const SbString &name, SoTexture *tex) |
Convenience method to create an SoShaderParameterImage with the specified name and value and add it to this shader program. | |
Public Member Functions inherited from SoNode | |
virtual void | setOverride (const SbBool state) |
Turns the override flag on or off. | |
virtual SbBool | isOverride () const |
Returns the state of the override flag. | |
virtual SoNode * | copy (SbBool copyConnections=FALSE) const |
Creates and returns an exact copy of the node. | |
virtual SbBool | affectsState () const |
Returns TRUE if a node has an effect on the state during traversal. | |
virtual void | touch () |
Marks an instance as modified, simulating a change to it. | |
Public Member Functions inherited from SoFieldContainer | |
void | setToDefaults () |
Sets all fields in this object to their default values. | |
SbBool | hasDefaultValues () const |
Returns TRUE if all of the object's fields have their default values. | |
SbBool | fieldsAreEqual (const SoFieldContainer *fc) const |
Returns TRUE if this object's fields are exactly equal to fc's fields. | |
void | copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE) |
Copies the contents of fc's fields into this object's fields. | |
SoNONUNICODE SbBool | set (const char *fieldDataString) |
Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format. | |
SbBool | set (const SbString &fieldDataString) |
Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format. | |
void | get (SbString &fieldDataString) |
Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
virtual int | getFields (SoFieldList &list) const |
Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
virtual int | getAllFields (SoFieldList &list) const |
Returns a list of fields, including the eventIn's and eventOut's. | |
virtual SoField * | getField (const SbName &fieldName) const |
Returns a the field of this object whose name is fieldName. | |
virtual SoField * | getEventIn (const SbName &fieldName) const |
Returns a the eventIn with the given name. | |
virtual SoField * | getEventOut (const SbName &fieldName) const |
Returns the eventOut with the given name. | |
SbBool | getFieldName (const SoField *field, SbName &fieldName) const |
Returns the name of the given field in the fieldName argument. | |
SbBool | enableNotify (SbBool flag) |
Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE). | |
SbBool | isNotifyEnabled () const |
Notification is the process of telling interested objects that this object has changed. | |
virtual void | setUserData (void *data) |
Sets application data. | |
void * | getUserData (void) const |
Gets user application data. | |
Public Member Functions inherited from SoBase | |
virtual SbName | getName () const |
Returns the name of an instance. | |
virtual void | setName (const SbName &name) |
Sets the name of an instance. | |
void | setSynchronizable (const bool b) |
Sets this to be a ScaleViz synchronizable object. | |
bool | isSynchronizable () const |
Gets the ScaleViz synchronizable state of this object. | |
Public Member Functions inherited from SoRefCounter | |
void | ref () const |
Adds a reference to an instance. | |
void | unref () const |
Removes a reference from an instance. | |
void | unrefNoDelete () const |
unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero. | |
int | getRefCount () const |
Returns current reference count. | |
void | lock () const |
lock this instance. | |
void | unlock () const |
unlock this instance. | |
Public Member Functions inherited from SoTypedObject | |
SbBool | isOfType (const SoType &type) const |
Returns TRUE if this object is of the type specified in type or is derived from that type. | |
template<typename TypedObjectClass > | |
SbBool | isOfType () const |
Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class. | |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
static unsigned int | getNumReservedTextures () |
Returns the number of reserved texture units. | |
Static Public Member Functions inherited from SoNode | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
static SoNode * | getByName (const SbName &name) |
A node's name can be set using SoBase::setName(). | |
static int | getByName (const SbName &name, SoNodeList &list) |
A node's name can be set using SoBase::setName(). | |
Static Public Member Functions inherited from SoFieldContainer | |
static SoType | getClassTypeId () |
Returns the type of this class. | |
Static Public Member Functions inherited from SoBase | |
static SoType | getClassTypeId () |
Returns type identifier for this class. | |
Static Public Member Functions inherited from SoTypedObject | |
static SoType | getClassTypeId () |
Returns the type identifier for this class. | |
Public Attributes | |
SoMFNode | shaderObject |
Specifies the list of shader objects (i.e., vertex shaders, geometry and fragment shaders) which form the shader program. | |
SoSFEnum | geometryInputType |
Specifies the input primitive type of the current geometry shader if any (not used otherwise). | |
SoSFEnum | geometryOutputType |
Specifies the output primitive type of the current geometry shader if any (not used otherwise). | |
SoSFBool | vertexProgramTwoSide |
If set to TRUE, vertex shaders will operate in two-sided color mode. | |
SoSFBool | shadowShader |
Only used when an SoShadowGroup is active. | |
SoSFInt32 | maxGeometryOutputVertices |
Set the maximum number of vertices the geometry shader will emit in one invocation. | |
SoSFBool | generateTransparency |
If set to TRUE, then shapes affected by this shader will be considered transparent. | |
SoSFInt32 | patchLength |
Set the length of the fixed-size collection of vertices used by tessellation shaders. | |
SoMFNode | bufferObjects |
Specifies a list of SoShaderParameterBufferObject to use with this shader. | |
SoMFNode | images |
Specifies a list of SoShaderParameterImage nodes to use with this shader. | |
Friends | |
class | SoUniformShaderParameter |
This property node defines the complete shader program for all subsequent shapes. A shader program may contain any graphics pipeline stage defined by the derivatives of a SoShaderObject. These stage programs are stored in the field shaderObject. Any Modifications that occur in the shader objects are dynamically detected and the state is updated.
The supported shading language of the program source is OpenGL Shader Language (GLSL) . Furthermore, the Open Inventor shader API or VolumeViz shader API must be used to write any GLSL shader program. See Shaders for detail.
Uniform shader parameters can be set per shader object and are available for all pipeline stages of the shader program. Uniform means a constant value during the shader execution. A uniform parameter is represented by an instance of a specific subclass of SoUniformShaderParameter. For example, an SoShaderParameter1i holds a single integer value.
Vertex parameters can be accessible from a vertex shader object. Vertex parameters are per-vertex data passed from the application to the vertex shader. A vertex parameter is represented by an instance of a specific subclass of SoVertexShaderParameter. For example, an SoVertexShaderParameter1f holds a set of floating point values and an SoVertexShaderParameter3f holds a set of SbVec3f values.
SoShaderProgram has specialized subclasses for volume visualization. If you are using the VolumeViz extension, see SoVolumeShader and SoVolumeRenderingQuality nodes.
Notes:
Tips:
shaderObject | NULL |
geometryInputType | TRIANGLES_INPUT |
geometryOutputType | TRIANGLE_STRIP_OUTPUT |
vertexProgramTwoSide | FALSE |
shadowShader | FALSE |
maxGeometryOutputVertices | -1 |
generateTransparency | FALSE |
patchLength | 0 |
Shaders, SoFragmentShader, SoGeometryShader, SoShaderObject, SoTessellationControlShader, SoTessellationEvaluationShader, SoUniformShaderParameter, SoVertexShader, SoVertexShaderParameter
Definition at line 231 of file SoShaderProgram.h.
Geometry input type.
Used with field geometryInputType.
Enumerator | |
---|---|
POINTS_INPUT | The input geometry should be interpreted as points. Geometry shaders that operate on points are valid only for the SoPointSet and SoIndexedPointSet nodes. There is only a single vertex available for each geometry shader invocation. |
LINES_INPUT | The input geometry should be interpreted as lines. Geometry shaders that operate on line segments are valid only for the SoLineSet or SoIndexedLineSet nodes. There are two vertices available for each geometry shader invocation. The first vertex refers to the vertex at the beginning of the line segment and the second vertex refers to the vertex at the end of the line segment. |
TRIANGLES_INPUT | The input geometry should be interpreted as triangles. Geometry shaders that operate on triangles are valid only for geometry nodes that generate triangles, for example, SoTriangleStripSet. There are three vertices available for each program invocation. The first, second and third vertices refer to attributes of the first, second and third vertex of the triangle, respectively. Default. |
Definition at line 239 of file SoShaderProgram.h.
Geometry ouput type.
Used with field geometryOutputType.
Enumerator | |
---|---|
POINTS_OUTPUT | |
LINE_STRIP_OUTPUT | |
TRIANGLE_STRIP_OUTPUT | Default. |
Definition at line 273 of file SoShaderProgram.h.
SoShaderProgram::SoShaderProgram | ( | ) |
Constructor.
SoShaderParameterImage * SoShaderProgram::addShaderParameterImage | ( | const SbString & | name, |
SoTexture * | tex | ||
) |
Convenience method to create an SoShaderParameterImage with the specified name and value and add it to this shader program.
|
static |
Returns the type identifier for this class.
|
inline |
Returns the fragment shader at the specified position.
Definition at line 793 of file SoShaderProgram.h.
|
inline |
Returns the geometry shader at the specified position.
Definition at line 823 of file SoShaderProgram.h.
|
static |
Returns the number of reserved texture units.
|
inline |
Returns the tessellation control shader at the specified position.
Definition at line 838 of file SoShaderProgram.h.
|
inline |
Returns the tessellation evaluation shader at the specified position.
Definition at line 853 of file SoShaderProgram.h.
|
virtual |
Returns the type identifier for this specific instance.
Reimplemented from SoNode.
Reimplemented in SoVolumeIsosurface, SoVolumeRenderingQuality, and SoVolumeShader.
|
inline |
Returns the vertex shader at the specified position.
Definition at line 808 of file SoShaderProgram.h.
|
virtual |
Convenience method to create a compute shader with the specified filename and add it at the specified position.
Return value is the new compute shader.
|
virtual |
Convenience method to create a fragment shader with the specified filename and add it at the specified position.
Return value is the new fragment shader.
Reimplemented in SoVolumeShader.
|
virtual |
Convenience method to create a geometry shader with the specified filename and add it at the specified position.
Return value is the new geometry shader.
|
virtual |
Convenience method to create a tessellation control shader with the specified filename and add it at the specified position.
Return value is the new tessellation control shader.
|
virtual |
Convenience method to create a tessellation evaluation shader with the specified filename and add it at the specified position.
Return value is the new tessellation evaluation shader.
|
virtual |
Convenience method to create a vertex shader with the specified filename and add it at the specified position.
Return value is the new vertex shader.
Reimplemented in SoVolumeShader.
|
friend |
Definition at line 787 of file SoShaderProgram.h.
SoMFNode SoShaderProgram::bufferObjects |
Specifies a list of SoShaderParameterBufferObject to use with this shader.
Default is empty. NOTE: field available since Open Inventor 9.8
Definition at line 368 of file SoShaderProgram.h.
SoSFBool SoShaderProgram::generateTransparency |
If set to TRUE, then shapes affected by this shader will be considered transparent.
Otherwise, the shape transparency is deducted from the state.
This allows Open Inventor to apply the correct handling for the current transparency mode.
Default is FALSE.
NOTE: field available since Open Inventor 9.0
Definition at line 353 of file SoShaderProgram.h.
SoSFEnum SoShaderProgram::geometryInputType |
Specifies the input primitive type of the current geometry shader if any (not used otherwise).
Use enum GeometryInputType. Default is TRIANGLES_INPUT.
NOTE: field available since Open Inventor 7.0
Definition at line 297 of file SoShaderProgram.h.
SoSFEnum SoShaderProgram::geometryOutputType |
Specifies the output primitive type of the current geometry shader if any (not used otherwise).
Use enum GeometryOutputType. Default is TRIANGLE_STRIP_OUTPUT.
NOTE: field available since Open Inventor 7.0
Definition at line 305 of file SoShaderProgram.h.
SoMFNode SoShaderProgram::images |
Specifies a list of SoShaderParameterImage nodes to use with this shader.
Default is empty. NOTE: field available since Open Inventor 10.10
Definition at line 375 of file SoShaderProgram.h.
SoSFInt32 SoShaderProgram::maxGeometryOutputVertices |
Set the maximum number of vertices the geometry shader will emit in one invocation.
Default is -1 which means it is set to the hardware limit.
NOTE: field available since Open Inventor 8.1
Definition at line 340 of file SoShaderProgram.h.
SoSFInt32 SoShaderProgram::patchLength |
Set the length of the fixed-size collection of vertices used by tessellation shaders.
Default is 0.
NOTE: field available since Open Inventor 9.3
Definition at line 361 of file SoShaderProgram.h.
SoMFNode SoShaderProgram::shaderObject |
Specifies the list of shader objects (i.e., vertex shaders, geometry and fragment shaders) which form the shader program.
Be careful, with some languages (CG_PROGRAM or ARB_PROGRAM), only one vertex program and one fragment program can be active at the same time. In this case, only the first vertex shader and the first fragment shader are used.
Definition at line 289 of file SoShaderProgram.h.
SoSFBool SoShaderProgram::shadowShader |
Only used when an SoShadowGroup is active.
Default is FALSE. If set to FALSE, a default shader will be used during the shadowmap generation pass. If TRUE, the shader will be used as is and must handle the shadowmap pass correctly:
NOTE: field available since Open Inventor 8.1
Definition at line 332 of file SoShaderProgram.h.
SoSFBool SoShaderProgram::vertexProgramTwoSide |
If set to TRUE, vertex shaders will operate in two-sided color mode.
Default is FALSE.
NOTE: field available since Open Inventor 7.2
Definition at line 313 of file SoShaderProgram.h.