SoShaderProgram Class Reference
[Shaders]

VSG extension Shader program property node. More...

#include <Inventor/nodes/SoShaderProgram.h>

Inheritance diagram for SoShaderProgram:
SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject SoVolumeShader SoVolumeIsosurface SoVolumeRenderingQuality

List of all members.

Classes

struct  Members
 member variables

Public Types

enum  GeometryInputType {
  POINTS_INPUT = GL_POINTS,
  LINES_INPUT = GL_LINES,
  TRIANGLES_INPUT = GL_TRIANGLES
}
enum  GeometryOutputType {
  POINTS_OUTPUT = GL_POINTS,
  LINE_STRIP_OUTPUT = GL_LINE_STRIP,
  TRIANGLE_STRIP_OUTPUT = GL_TRIANGLE_STRIP
}

Public Member Functions

virtual SoType getTypeId () const
 SoShaderProgram ()
SoFragmentShadergetFragmentShader (int pos) const
SoVertexShadergetVertexShader (int pos) const
SoGeometryShadergetGeometryShader (int pos) const
virtual SoFragmentShadersetFragmentShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME)
virtual SoVertexShadersetVertexShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME)
virtual SoGeometryShadersetGeometryShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME)
virtual SoComputeShadersetComputeShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME)
SoTessellationControlShadergetTessellationControlShader (int pos) const
SoTessellationEvaluationShadergetTessellationEvaluationShader (int pos) const
virtual
SoTessellationControlShader
setTessellationControlShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME)
virtual
SoTessellationEvaluationShader
setTessellationEvaluationShader (int pos, const SbString &filenameOrSource, SoShaderObject::SourceType sourceType=SoShaderObject::FILENAME)
SoShaderParameterImageaddShaderParameterImage (const SbString &name, SoTexture *tex)

Static Public Member Functions

static SoType getClassTypeId ()
static unsigned int getNumReservedTextures ()

Public Attributes

SoMFNode shaderObject
SoSFEnum geometryInputType
SoSFEnum geometryOutputType
SoSFBool vertexProgramTwoSide
SoSFBool shadowShader
SoSFInt32 maxGeometryOutputVertices
SoSFBool generateTransparency
SoSFInt32 patchLength
SoMFNode bufferObjects
SoMFNode images

Friends

class SoUniformShaderParameter

Detailed Description

VSG extension Shader program property node.

This property node defines the complete shader program for all subsequent shapes. A complete shader program may contain vertex shaders (SoVertexShader), geometry shaders (SoGeometryShader) and/or fragment shaders (SoFragmentShaders). See SoShaderObject for information common to all these classes.

With some languages such as NVIDIA Cg or assembly language (ARB_vertex_program/ARB_fragment_program), only one vertex and one fragment program can be active at the same time. The field shaderObject contains the vertex, geometry and fragment shader objects which form the shader program. Each shader object should be of type SoShaderObject. Modifications that occur in shader objects are dynamically detected and the state is updated.

Uniform parameters may be set for each shader object. Uniform means, in the case of a vertex or geometry program, a value which is the same for all vertices in a primitive, and, in the case of a fragment program, a value which is the same for all fragments created by a primitive. Each uniform parameter is represented by an instance of a specific subclass of SoUniformShaderParameter. For example, an SoShaderParameter1i holds a single integer value.

Vertex parameters may be set for a vertex shader object. Vertex parameters are per-vertex data passed from the application to the vertex shader. Vertex parameters are 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:

FILE FORMAT/DEFAULT

EXAMPLE

ACTION BEHAVIOR

SEE ALSO

SoFragmentShader, SoGeometryShader, SoShaderObject, SoTessellationControlShader, SoTessellationEvaluationShader, SoUniformShaderParameter, SoVertexShader, SoVertexShaderParameter

See related examples:

GPUGeometry, InterleavedVertexAttribFeedback, SimpleVertexAttribFeedback, VertexAttribFeedback, PointCloud, AnimatedFlag, GeometryShader, PixelLighting, shadowShader, SimplePassthrough, TessellationShader, ToonShading, ShadersBrowser, MultiTransferFunctions


Member Enumeration Documentation

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.

Geometry ouput type.

Used with field geometryOutputType.

Enumerator:
POINTS_OUTPUT 
LINE_STRIP_OUTPUT 
TRIANGLE_STRIP_OUTPUT 

Default.


Constructor & Destructor Documentation

SoShaderProgram::SoShaderProgram (  ) 

Constructor.


Member Function Documentation

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 SoType SoShaderProgram::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoNode.

Reimplemented in SoVolumeIsosurface, SoVolumeRenderingQuality, and SoVolumeShader.

SoFragmentShader * SoShaderProgram::getFragmentShader ( int  pos  )  const [inline]

Returns the fragment shader at the specified position.

SoGeometryShader * SoShaderProgram::getGeometryShader ( int  pos  )  const [inline]

Returns the geometry shader at the specified position.

static unsigned int SoShaderProgram::getNumReservedTextures (  )  [static]

Returns the number of reserved texture units.

SoTessellationControlShader * SoShaderProgram::getTessellationControlShader ( int  pos  )  const [inline]

Returns the tessellation control shader at the specified position.

SoTessellationEvaluationShader * SoShaderProgram::getTessellationEvaluationShader ( int  pos  )  const [inline]

Returns the tessellation evaluation shader at the specified position.

virtual SoType SoShaderProgram::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoNode.

Reimplemented in SoVolumeIsosurface, SoVolumeRenderingQuality, and SoVolumeShader.

SoVertexShader * SoShaderProgram::getVertexShader ( int  pos  )  const [inline]

Returns the vertex shader at the specified position.

virtual SoComputeShader* SoShaderProgram::setComputeShader ( int  pos,
const SbString filenameOrSource,
SoShaderObject::SourceType  sourceType = SoShaderObject::FILENAME 
) [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 SoFragmentShader* SoShaderProgram::setFragmentShader ( int  pos,
const SbString filenameOrSource,
SoShaderObject::SourceType  sourceType = SoShaderObject::FILENAME 
) [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 SoGeometryShader* SoShaderProgram::setGeometryShader ( int  pos,
const SbString filenameOrSource,
SoShaderObject::SourceType  sourceType = SoShaderObject::FILENAME 
) [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 SoTessellationControlShader* SoShaderProgram::setTessellationControlShader ( int  pos,
const SbString filenameOrSource,
SoShaderObject::SourceType  sourceType = SoShaderObject::FILENAME 
) [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 SoTessellationEvaluationShader* SoShaderProgram::setTessellationEvaluationShader ( int  pos,
const SbString filenameOrSource,
SoShaderObject::SourceType  sourceType = SoShaderObject::FILENAME 
) [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 SoVertexShader* SoShaderProgram::setVertexShader ( int  pos,
const SbString filenameOrSource,
SoShaderObject::SourceType  sourceType = SoShaderObject::FILENAME 
) [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.


Friends And Related Function Documentation

friend class SoUniformShaderParameter [friend]

Member Data Documentation

Specifies a list of SoShaderParameterBufferObject to use with this shader.

Default is empty. NOTE: field available since Open Inventor 9.8

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

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

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

Specifies a list of SoShaderParameterImage nodes to use with this shader.

Default is empty. NOTE: field available since Open Inventor 10.10

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

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

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.

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:

  • If the uniform OivShadowPass is true, call OivGenerateShadowMap() and output nothing into gl_FragColor, but discard fragments if needed.
  • If the uniform OivShadowPass is false, follow the normal render path If the shader doesn't modify the depth (with a discard or an alpha test), Open Inventor will handle the shadowmap generation pass automatically. Default is FALSE
    See also: SoShadowGroup
NOTE: field available since Open Inventor 8.1

If set to TRUE, vertex shaders will operate in two-sided color mode.

Default is FALSE.

NOTE: field available since Open Inventor 7.2


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/