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 Types inherited from vtkObject | |
typedef vtkObjectBase | 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. More... | |
void | ReleaseGraphicsResources (vtkWindow *win) |
int | GetHandle () const |
Get the handle of the shader program. More... | |
std::string | GetError () const |
Get the error message (empty if none) for the shader program. More... | |
bool | EnableAttributeArray (const char *name) |
Enable the named attribute array. More... | |
bool | DisableAttributeArray (const char *name) |
Disable the named attribute array. More... | |
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. More... | |
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. More... | |
bool | SetUniformi (const char *name, int v) |
Set the name uniform value to int v . More... | |
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. More... | |
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 void | SetNumberOfOutputs (unsigned int) |
virtual vtkShader * | GetVertexShader () |
void | SetVertexShader (vtkShader *) |
virtual vtkShader * | GetFragmentShader () |
void | SetFragmentShader (vtkShader *) |
virtual vtkShader * | GetGeometryShader () |
void | SetGeometryShader (vtkShader *) |
virtual bool | GetCompiled () |
virtual void | SetCompiled (bool) |
virtual void | CompiledOn () |
virtual void | CompiledOff () |
std::string | GetMD5Hash () const |
void | SetMD5Hash (const std::string &hash) |
Public Member Functions inherited from vtkObject | |
vtkObject * | NewInstance () const |
virtual void | DebugOn () |
virtual void | DebugOff () |
bool | GetDebug () |
void | SetDebug (bool debugFlag) |
virtual void | Modified () |
virtual unsigned long | GetMTime () |
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
vtkCommand * | GetCommand (unsigned long tag) |
void | RemoveObserver (vtkCommand *) |
void | RemoveObservers (unsigned long event, vtkCommand *) |
void | RemoveObservers (const char *event, vtkCommand *) |
int | HasObserver (unsigned long event, vtkCommand *) |
int | HasObserver (const char *event, vtkCommand *) |
void | RemoveObserver (unsigned long tag) |
void | RemoveObservers (unsigned long event) |
void | RemoveObservers (const char *event) |
void | RemoveAllObservers () |
int | HasObserver (unsigned long event) |
int | HasObserver (const char *event) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
template<class U , class T > | |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
int | InvokeEvent (unsigned long event, void *callData) |
int | InvokeEvent (const char *event, void *callData) |
int | InvokeEvent (unsigned long event) |
int | InvokeEvent (const char *event) |
Public Member Functions inherited from vtkObjectBase | |
const char * | GetClassName () const |
virtual void | Delete () |
virtual void | FastDelete () |
void | Print (ostream &os) |
virtual void | Register (vtkObjectBase *o) |
virtual void | UnRegister (vtkObjectBase *o) |
void | SetReferenceCount (int) |
void | PrintRevisions (ostream &) |
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
int | GetReferenceCount () |
Static Public Member Functions | |
static vtkShaderProgram * | New () |
static int | IsTypeOf (const char *type) |
static vtkShaderProgram * | SafeDownCast (vtkObjectBase *o) |
static bool | Substitute (std::string &source, const std::string &search, const std::string replace, bool all=true) |
Static Public Member Functions inherited from vtkObject | |
static int | IsTypeOf (const char *type) |
static vtkObject * | SafeDownCast (vtkObjectBase *o) |
static vtkObject * | New () |
static void | BreakOnError () |
static void | SetGlobalWarningDisplay (int val) |
static void | GlobalWarningDisplayOn () |
static void | GlobalWarningDisplayOff () |
static int | GetGlobalWarningDisplay () |
Static Public Member Functions inherited from vtkObjectBase | |
static int | IsTypeOf (const char *name) |
static vtkObjectBase * | New () |
Protected Member Functions | |
virtual vtkObjectBase * | NewInstanceInternal () const |
vtkShaderProgram () | |
~vtkShaderProgram () | |
bool | AttachShader (const vtkShader *shader) |
Attach the supplied shader to this program. More... | |
bool | DetachShader (const vtkShader *shader) |
Detach the supplied shader from this program. More... | |
virtual int | CompileShader () |
bool | Link () |
Attempt to link the shader program. More... | |
bool | Bind () |
Bind the program in order to use it. More... | |
void | Release () |
Releases the shader program from the current context. More... | |
bool | SetAttributeArrayInternal (const char *name, void *buffer, int type, int tupleSize, NormalizeOption normalize) |
Protected Member Functions inherited from vtkObject | |
vtkObject () | |
virtual | ~vtkObject () |
virtual void | RegisterInternal (vtkObjectBase *, int check) |
virtual void | UnRegisterInternal (vtkObjectBase *, int check) |
void | InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL) |
void | InternalReleaseFocus () |
Protected Member Functions inherited from vtkObjectBase | |
vtkObjectBase () | |
virtual | ~vtkObjectBase () |
virtual void | CollectRevisions (ostream &) |
virtual void | ReportReferences (vtkGarbageCollector *) |
vtkObjectBase (const vtkObjectBase &) | |
void | operator= (const vtkObjectBase &) |
Protected Attributes | |
vtkShader * | VertexShader |
vtkShader * | FragmentShader |
vtkShader * | GeometryShader |
std::string | MD5Hash |
int | Handle |
int | VertexShaderHandle |
int | FragmentShaderHandle |
int | GeometryShaderHandle |
bool | Linked |
bool | Bound |
bool | Compiled |
unsigned int | NumberOfOutputs |
std::string | Error |
std::map< std::string, int > | Attributes |
Protected Attributes inherited from vtkObject | |
bool | Debug |
vtkTimeStamp | MTime |
vtkSubjectHelper * | SubjectHelper |
Protected Attributes inherited from vtkObjectBase | |
vtkAtomicInt32 | ReferenceCount |
vtkWeakPointerBase ** | WeakPointers |
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.
Definition at line 46 of file vtkShaderProgram.h.
Options for attribute normalization.
Definition at line 82 of file vtkShaderProgram.h.
|
protected |
|
protected |
|
static |
|
static |
|
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 |
|
protectedvirtual |
Reimplemented from vtkObject.
vtkShaderProgram* vtkShaderProgram::NewInstance | ( | ) | const |
|
virtual |
|
virtual |
Get the vertex shader for this program
void vtkShaderProgram::SetVertexShader | ( | vtkShader * | ) |
Get the vertex shader for this program
|
virtual |
Get the fragment shader for this program
void vtkShaderProgram::SetFragmentShader | ( | vtkShader * | ) |
Get the fragment shader for this program
|
virtual |
Get the geometry shader for this program
void vtkShaderProgram::SetGeometryShader | ( | vtkShader * | ) |
Get the geometry shader for this program
|
virtual |
Set/Get flag for if this program is compiled
|
virtual |
Set/Get flag for if this program is compiled
|
virtual |
Set/Get flag for if this program is compiled
|
virtual |
Set/Get flag for if this program is compiled
|
inline |
Set/Get the md5 hash of this program
Definition at line 76 of file vtkShaderProgram.h.
|
inline |
Set/Get the md5 hash of this program
Definition at line 77 of file vtkShaderProgram.h.
|
inline |
Check if the program is currently bound, or not.
Definition at line 101 of file vtkShaderProgram.h.
void vtkShaderProgram::ReleaseGraphicsResources | ( | vtkWindow * | win | ) |
release any graphics resources this class is using.
|
inline |
Get the handle of the shader program.
Definition at line 107 of file vtkShaderProgram.h.
|
inline |
Get the error message (empty if none) for the shader program.
Definition at line 110 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 | ||
) |
Set the name
uniform array to f
with count
elements.
|
virtual |
|
static |
perform in place string substitutions, indicate if a substitution was done this is useful for building up shader strings which typically involve lots of string substitutions. Return true if a substitution was done.
|
protected |
Attach the supplied shader to this program.
|
protected |
Detach the supplied shader from this program.
|
protectedvirtual |
Compile this shader program and attached shaders
|
protected |
Attempt to link the shader program.
|
protected |
Bind the program in order to use it.
If the program has not been linked then link() will be called.
|
protected |
Releases the shader program from the current context.
|
protected |
|
friend |
Definition at line 214 of file vtkShaderProgram.h.
|
friend |
Definition at line 281 of file vtkShaderProgram.h.
|
protected |
Definition at line 252 of file vtkShaderProgram.h.
|
protected |
Definition at line 253 of file vtkShaderProgram.h.
|
protected |
Definition at line 254 of file vtkShaderProgram.h.
|
protected |
Definition at line 257 of file vtkShaderProgram.h.
|
protected |
Definition at line 262 of file vtkShaderProgram.h.
|
protected |
Definition at line 263 of file vtkShaderProgram.h.
|
protected |
Definition at line 264 of file vtkShaderProgram.h.
|
protected |
Definition at line 265 of file vtkShaderProgram.h.
|
protected |
Definition at line 267 of file vtkShaderProgram.h.
|
protected |
Definition at line 268 of file vtkShaderProgram.h.
|
protected |
Definition at line 269 of file vtkShaderProgram.h.
|
protected |
Definition at line 275 of file vtkShaderProgram.h.
|
protected |
Definition at line 277 of file vtkShaderProgram.h.
|
protected |
Definition at line 279 of file vtkShaderProgram.h.