|
VTK
|
The ShaderProgram uses one or more Shader objects. More...
#include <vtkShaderProgram.h>


Public Types | |
| enum | NormalizeOption { Normalize, NoNormalize } |
| Options for attribute normalization. More... | |
| typedef vtkObject | Superclass |
Public Member Functions | |
| virtual int | IsA (const char *type) |
| vtkShaderProgram * | NewInstance () const |
| void | PrintSelf (ostream &os, vtkIndent indent) |
| bool | isBound () const |
| Check if the program is currently bound, or not. | |
| void | ReleaseGraphicsResources (vtkWindow *win) |
| int | GetHandle () const |
| Get the handle of the shader program. | |
| std::string | GetError () const |
| Get the error message (empty if none) for the shader program. | |
| bool | EnableAttributeArray (const char *name) |
| Enable the named attribute array. | |
| bool | DisableAttributeArray (const char *name) |
| Disable the named attribute array. | |
| bool | UseAttributeArray (const char *name, int offset, size_t stride, int elementType, int elementTupleSize, NormalizeOption normalize) |
| Use the named attribute array with the bound BufferObject. | |
| template<class T > | |
| bool | SetAttributeArray (const char *name, const T &array, int tupleSize, NormalizeOption normalize) |
| Upload the supplied array of tightly packed values to the named attribute. | |
| bool | SetUniformi (const char *name, int v) |
Set the name uniform value to int v. | |
| bool | SetUniformf (const char *name, float v) |
| bool | SetUniform2i (const char *name, const int v[2]) |
| bool | SetUniform2f (const char *name, const float v[2]) |
| bool | SetUniform3f (const char *name, const float v[3]) |
| bool | SetUniform4f (const char *name, const float v[4]) |
| bool | SetUniform3uc (const char *name, const unsigned char v[3]) |
| bool | SetUniform4uc (const char *name, const unsigned char v[4]) |
| bool | SetUniformMatrix (const char *name, vtkMatrix3x3 *v) |
| bool | SetUniformMatrix (const char *name, vtkMatrix4x4 *v) |
| bool | SetUniformMatrix3x3 (const char *name, float *v) |
| bool | SetUniformMatrix4x4 (const char *name, float *v) |
| bool | SetUniform1iv (const char *name, const int count, const int *f) |
Set the name uniform array to f with count elements. | |
| bool | SetUniform1fv (const char *name, const int count, const float *f) |
| bool | SetUniform2fv (const char *name, const int count, const float(*f)[2]) |
| bool | SetUniform3fv (const char *name, const int count, const float(*f)[3]) |
| bool | SetUniform4fv (const char *name, const int count, const float(*f)[4]) |
| virtual vtkShader * | GetVertexShader () |
| virtual vtkShader * | GetFragmentShader () |
| virtual vtkShader * | GetGeometryShader () |
| virtual bool | GetCompiled () |
| virtual void | SetCompiled (bool) |
| virtual void | CompiledOn () |
| virtual void | CompiledOff () |
| std::string | GetMD5Hash () const |
| void | SetMD5Hash (const std::string &hash) |
Static Public Member Functions | |
| static vtkShaderProgram * | New () |
| static int | IsTypeOf (const char *type) |
| static vtkShaderProgram * | SafeDownCast (vtkObjectBase *o) |
Protected Member Functions | |
| virtual vtkObjectBase * | NewInstanceInternal () const |
| vtkShaderProgram () | |
| ~vtkShaderProgram () | |
| bool | AttachShader (const vtkShader *shader) |
| Attach the supplied shader to this program. | |
| bool | DetachShader (const vtkShader *shader) |
| Detach the supplied shader from this program. | |
| virtual int | CompileShader () |
| bool | Link () |
| Attempt to link the shader program. | |
| bool | Bind () |
| Bind the program in order to use it. | |
| void | Release () |
| Releases the shader program from the current context. | |
| bool | SetAttributeArrayInternal (const char *name, void *buffer, int type, int tupleSize, NormalizeOption normalize) |
Protected Attributes | |
| vtkShader * | VertexShader |
| vtkShader * | FragmentShader |
| vtkShader * | GeometryShader |
| std::string | MD5Hash |
| int | Handle |
| int | VertexShaderHandle |
| int | FragmentShaderHandle |
| bool | Linked |
| bool | Bound |
| bool | Compiled |
| std::string | Error |
| std::map< std::string, int > | Attributes |
Friends | |
| class | vtkOpenGLShaderCache |
| class | VertexArrayObject |
The ShaderProgram uses one or more Shader objects.
a glsl shader program
This class creates a Vertex or Fragment shader, that can be attached to a ShaderProgram in order to render geometry etc.
This class contains the vertex, fragment, geometry shaders that combine to make a shader program
Definition at line 42 of file vtkShaderProgram.h.
Reimplemented from vtkObject.
Definition at line 46 of file vtkShaderProgram.h.
Options for attribute normalization.
Definition at line 79 of file vtkShaderProgram.h.
| vtkShaderProgram::vtkShaderProgram | ( | ) | [protected] |
| vtkShaderProgram::~vtkShaderProgram | ( | ) | [protected] |
| static vtkShaderProgram* vtkShaderProgram::New | ( | ) | [static] |
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
Reimplemented from vtkObject.
| static int vtkShaderProgram::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
| virtual int vtkShaderProgram::IsA | ( | const char * | name | ) | [virtual] |
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkObject.
| static vtkShaderProgram* vtkShaderProgram::SafeDownCast | ( | vtkObjectBase * | o | ) | [static] |
Reimplemented from vtkObject.
| virtual vtkObjectBase* vtkShaderProgram::NewInstanceInternal | ( | ) | const [protected, virtual] |
Reimplemented from vtkObject.
| vtkShaderProgram* vtkShaderProgram::NewInstance | ( | ) | const |
Reimplemented from vtkObject.
| void vtkShaderProgram::PrintSelf | ( | ostream & | os, |
| vtkIndent | indent | ||
| ) | [virtual] |
| virtual vtkShader* vtkShaderProgram::GetVertexShader | ( | ) | [virtual] |
Get the vertex shader for this program
| virtual vtkShader* vtkShaderProgram::GetFragmentShader | ( | ) | [virtual] |
Get the fragment shader for this program
| virtual vtkShader* vtkShaderProgram::GetGeometryShader | ( | ) | [virtual] |
Get the geometry shader for this program
| virtual bool vtkShaderProgram::GetCompiled | ( | ) | [virtual] |
Set/Get flag for if this program is compiled
| virtual void vtkShaderProgram::SetCompiled | ( | bool | ) | [virtual] |
Set/Get flag for if this program is compiled
| virtual void vtkShaderProgram::CompiledOn | ( | ) | [virtual] |
Set/Get flag for if this program is compiled
| virtual void vtkShaderProgram::CompiledOff | ( | ) | [virtual] |
Set/Get flag for if this program is compiled
| std::string vtkShaderProgram::GetMD5Hash | ( | ) | const [inline] |
Set/Get the md5 hash of this program
Definition at line 73 of file vtkShaderProgram.h.
| void vtkShaderProgram::SetMD5Hash | ( | const std::string & | hash | ) | [inline] |
Set/Get the md5 hash of this program
Definition at line 74 of file vtkShaderProgram.h.
| bool vtkShaderProgram::isBound | ( | ) | const [inline] |
Check if the program is currently bound, or not.
Definition at line 98 of file vtkShaderProgram.h.
| void vtkShaderProgram::ReleaseGraphicsResources | ( | vtkWindow * | win | ) |
release any graphics resources this class is using.
| int vtkShaderProgram::GetHandle | ( | ) | const [inline] |
Get the handle of the shader program.
Definition at line 104 of file vtkShaderProgram.h.
| std::string vtkShaderProgram::GetError | ( | void | ) | const [inline] |
Get the error message (empty if none) for the shader program.
Definition at line 107 of file vtkShaderProgram.h.
| bool vtkShaderProgram::EnableAttributeArray | ( | const char * | name | ) |
Enable the named attribute array.
Return false if the attribute array is not contained in the linked shader program.
| bool vtkShaderProgram::DisableAttributeArray | ( | const char * | name | ) |
Disable the named attribute array.
Return false if the attribute array is not contained in the linked shader program.
| bool vtkShaderProgram::UseAttributeArray | ( | const char * | name, |
| int | offset, | ||
| size_t | stride, | ||
| int | elementType, | ||
| int | elementTupleSize, | ||
| NormalizeOption | normalize | ||
| ) |
Use the named attribute array with the bound BufferObject.
| name | of the attribute (as seen in the shader program). |
| offset | into the bound BufferObject. |
| stride | The stride of the element access (i.e. the size of each element in the currently bound BufferObject). 0 may be used to indicate tightly packed data. |
| elementType | Tag identifying the memory representation of the element. |
| elementTupleSize | The number of elements per vertex (e.g. a 3D position attribute would be 3). |
| normalize | Indicates the range used by the attribute data. See NormalizeOption for more information. |
| bool vtkShaderProgram::SetAttributeArray | ( | const char * | name, |
| const T & | array, | ||
| int | tupleSize, | ||
| NormalizeOption | normalize | ||
| ) |
Upload the supplied array of tightly packed values to the named attribute.
BufferObject attributes should be preferred and this may be removed in future.
| name | Attribute name |
| array | Container of data. See note. |
| tupleSize | The number of elements per vertex, e.g. a 3D coordinate array will have a tuple size of 3. |
| normalize | Indicates the range used by the attribute data. See NormalizeOption for more information. |
| bool vtkShaderProgram::SetUniformi | ( | const char * | name, |
| int | v | ||
| ) |
Set the name uniform value to int v.
| bool vtkShaderProgram::SetUniformf | ( | const char * | name, |
| float | v | ||
| ) |
| bool vtkShaderProgram::SetUniform2i | ( | const char * | name, |
| const int | v[2] | ||
| ) |
| bool vtkShaderProgram::SetUniform2f | ( | const char * | name, |
| const float | v[2] | ||
| ) |
| bool vtkShaderProgram::SetUniform3f | ( | const char * | name, |
| const float | v[3] | ||
| ) |
| bool vtkShaderProgram::SetUniform4f | ( | const char * | name, |
| const float | v[4] | ||
| ) |
| bool vtkShaderProgram::SetUniform3uc | ( | const char * | name, |
| const unsigned char | v[3] | ||
| ) |
| bool vtkShaderProgram::SetUniform4uc | ( | const char * | name, |
| const unsigned char | v[4] | ||
| ) |
| bool vtkShaderProgram::SetUniformMatrix | ( | const char * | name, |
| vtkMatrix3x3 * | v | ||
| ) |
| bool vtkShaderProgram::SetUniformMatrix | ( | const char * | name, |
| vtkMatrix4x4 * | v | ||
| ) |
| bool vtkShaderProgram::SetUniformMatrix3x3 | ( | const char * | name, |
| float * | v | ||
| ) |
| bool vtkShaderProgram::SetUniformMatrix4x4 | ( | const char * | name, |
| float * | v | ||
| ) |
| bool vtkShaderProgram::SetUniform1iv | ( | const char * | name, |
| const int | count, | ||
| const int * | f | ||
| ) |
Set the name uniform array to f with count elements.
| bool vtkShaderProgram::SetUniform1fv | ( | const char * | name, |
| const int | count, | ||
| const float * | f | ||
| ) |
| bool vtkShaderProgram::SetUniform2fv | ( | const char * | name, |
| const int | count, | ||
| const float(*) | f[2] | ||
| ) |
| bool vtkShaderProgram::SetUniform3fv | ( | const char * | name, |
| const int | count, | ||
| const float(*) | f[3] | ||
| ) |
| bool vtkShaderProgram::SetUniform4fv | ( | const char * | name, |
| const int | count, | ||
| const float(*) | f[4] | ||
| ) |
| bool vtkShaderProgram::AttachShader | ( | const vtkShader * | shader | ) | [protected] |
Attach the supplied shader to this program.
| bool vtkShaderProgram::DetachShader | ( | const vtkShader * | shader | ) | [protected] |
Detach the supplied shader from this program.
| virtual int vtkShaderProgram::CompileShader | ( | ) | [protected, virtual] |
Compile this shader program and attached shaders
| bool vtkShaderProgram::Link | ( | ) | [protected] |
Attempt to link the shader program.
| bool vtkShaderProgram::Bind | ( | ) | [protected] |
Bind the program in order to use it.
If the program has not been linked then link() will be called.
| void vtkShaderProgram::Release | ( | ) | [protected] |
Releases the shader program from the current context.
| bool vtkShaderProgram::SetAttributeArrayInternal | ( | const char * | name, |
| void * | buffer, | ||
| int | type, | ||
| int | tupleSize, | ||
| NormalizeOption | normalize | ||
| ) | [protected] |
friend class vtkOpenGLShaderCache [friend] |
Definition at line 192 of file vtkShaderProgram.h.
friend class VertexArrayObject [friend] |
Definition at line 252 of file vtkShaderProgram.h.
vtkShader* vtkShaderProgram::VertexShader [protected] |
Definition at line 230 of file vtkShaderProgram.h.
vtkShader* vtkShaderProgram::FragmentShader [protected] |
Definition at line 231 of file vtkShaderProgram.h.
vtkShader* vtkShaderProgram::GeometryShader [protected] |
Definition at line 232 of file vtkShaderProgram.h.
std::string vtkShaderProgram::MD5Hash [protected] |
Definition at line 235 of file vtkShaderProgram.h.
int vtkShaderProgram::Handle [protected] |
Definition at line 240 of file vtkShaderProgram.h.
int vtkShaderProgram::VertexShaderHandle [protected] |
Definition at line 241 of file vtkShaderProgram.h.
int vtkShaderProgram::FragmentShaderHandle [protected] |
Definition at line 242 of file vtkShaderProgram.h.
bool vtkShaderProgram::Linked [protected] |
Definition at line 244 of file vtkShaderProgram.h.
bool vtkShaderProgram::Bound [protected] |
Definition at line 245 of file vtkShaderProgram.h.
bool vtkShaderProgram::Compiled [protected] |
Definition at line 246 of file vtkShaderProgram.h.
std::string vtkShaderProgram::Error [protected] |
Definition at line 248 of file vtkShaderProgram.h.
std::map<std::string, int> vtkShaderProgram::Attributes [protected] |
Definition at line 250 of file vtkShaderProgram.h.
1.8.0