H3D::ShaderProgram Class Reference
[X3D node classes.]

The ShaderProgram node provides the source and interface to a self contained program that occupies one part of the rendering process: either a vertex or fragment shader. More...

#include <H3D/ShaderProgram.h>

Inheritance diagram for H3D::ShaderProgram:

Inheritance graph

List of all members.

Public Member Functions

 ShaderProgram (Inst< SFNode > _metadata=0, Inst< DisplayList > _displayList=0, Inst< MFString > _url=0, Inst< SFString > _type=0)
 Constructor.
virtual ~ShaderProgram ()
 Destructor.
virtual void enableCGShaderProgram ()
 Makes the shader program active.
virtual void disableCGShaderProgram ()
 Disable the shader program.
virtual void initCGShaderProgram ()
 Initialize a shader program from the current field values.
virtual void destroyCGShaderProgram ()
 Destroy the current cg program object.
virtual void setCGProfile (const string &profile)
 Set the cg profile to use.
virtual void render ()
 Render sets the uniform variables of the shader program.
virtual bool addField (const string &name, const Field::AccessType &access, Field *field)
 The addField method is specialized to add a route from the field added to the displayList field.
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value.

Public Attributes

auto_ptr< SFStringtype
 The type field indicates whether this object shall be compiled as a vertex shader, fragment shader, or other future-defined shader type.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.


Detailed Description

The ShaderProgram node provides the source and interface to a self contained program that occupies one part of the rendering process: either a vertex or fragment shader.

The shader source is read from the URL specified by the url field. When the url field contains no values ([]), this object instance is ignored. Shader source files shall be plain text encoded as specified for MIME type text/plain and interpreted according to the containing node's language definition.

Internal routes:
ShaderProgram.dot

Member Function Documentation

bool ShaderProgram::addField ( const string &  name,
const Field::AccessType access,
Field field 
) [virtual]

The addField method is specialized to add a route from the field added to the displayList field.

Reimplemented from H3D::H3DDynamicFieldsObject.

References H3D::H3DDisplayListObject::displayList, and H3D::Field::route().

virtual string H3D::ShaderProgram::defaultXMLContainerField (  )  [inline, virtual]

Returns the default xml containerField attribute value.

For this node it is "programs".

Reimplemented from H3D::Node.

void ShaderProgram::setCGProfile ( const string &  profile  )  [virtual]

Set the cg profile to use.

The string is one of the strings specified in the X3D specification (CG Annex K). Returns true if profile is supported.

Referenced by ShaderProgram().


Member Data Documentation

The type field indicates whether this object shall be compiled as a vertex shader, fragment shader, or other future-defined shader type.

Valid values are "VERTEX" and "FRAGMENT".

Access type: initializeOnly
ShaderProgram_type.dot

Referenced by initCGShaderProgram(), and ShaderProgram().


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

Generated on Fri Nov 7 10:30:51 2008 for H3D API by  doxygen 1.5.7