Go to the documentation of this file.
28 #ifndef vtkShaderProgram2_h
29 #define vtkShaderProgram2_h
32 #include "vtkRenderingOpenGLModule.h"
90 vtkGetMacro(PrintErrors,
bool);
302 vtkGetMacro(GeometryTypeIn,
int);
319 vtkGetMacro(GeometryVerticesOut,
int);
335 vtkGetMacro(GeometryTypeOut,
int);
361 { this->SetUniform1f(
name, &val); }
363 { this->SetUniform1f(this->GetUniformLocation(
name), val); }
365 { this->SetUniform2f(this->GetUniformLocation(
name), val); }
367 { this->SetUniform3f(this->GetUniformLocation(
name), val); }
369 { this->SetUniform4f(this->GetUniformLocation(
name), val); }
372 { this->SetUniform1i(
name, &val); }
374 { this->SetUniform1i(this->GetUniformLocation(
name), val); }
376 { this->SetUniform2i(this->GetUniformLocation(
name), val); }
378 { this->SetUniform3i(this->GetUniformLocation(
name), val); }
380 { this->SetUniform4i(this->GetUniformLocation(
name), val); }
383 { this->SetUniform1f(loc, &val); }
390 { this->SetUniform1i(loc, &val); }
477 #define vtkShaderProgram2SetUniformCopyCastMacro(toLetter, toType, num) \
478 template<typename fromType> \
479 void vtkShaderProgram2::SetUniform##num##toLetter##t(const char *name, fromType *fvalues) \
481 toType tvalues[num]; \
482 for (int i=0; i<num; ++i) \
484 tvalues[i] = static_cast<toType>(fvalues[i]); \
486 this->SetUniform##num##toLetter(name, tvalues); \
488 template<typename fromType> \
489 void vtkShaderProgram2::SetUniform##num##toLetter##t(int location, fromType *fvalues) \
491 assert(location!=-1); \
492 toType tvalues[num]; \
493 for (int i=0; i<num; ++i) \
495 tvalues[i] = static_cast<toType>(fvalues[i]); \
497 this->SetUniform##num##toLetter(location, tvalues); \
int GetUniformLocationInternal(const char *name)
Get the location of a uniform, without caring if it really exists.
@ VTK_SHADER_PROGRAM2_LINK_SUCCEEDED
void SetUniform3i(int loc, int *val)
void SetUniform3ft(const char *name, T *value)
vtkTimeStamp LastSendUniformsTime
void SetUniform2f(const char *name, float *val)
void SetUniformi(const char *name, int val)
void SetUniform2it(int loc, T *value)
void SetUniform1f(int loc, float *val)
void SetUniform4it(int loc, T *value)
@ VTK_GEOMETRY_SHADER_OUT_TYPE_TRIANGLE_STRIP
#define vtkShaderProgram2SetUniformCopyCastMacro(toLetter, toType, num)
vtkShader2Collection * Shaders
a list of Shader2 objects.
record modification and/or execution time
bool DisplayListUnderCreationInCompileMode()
Tells if a display list is under construction with GL_COMPILE mode.
bool HasVertexShaders()
Tells if at least one of the shaders is a vertex shader.
bool IsUsed()
Tell if the program is the one currently used by OpenGL.
virtual void ReleaseGraphicsResources()
Release OpenGL resource (program id and sub-resources).
vtkShaderProgram2GeometryOutType
int GetAttributeLocation(const char *name)
Returns the generic attribute location.
abstract base class for most VTK objects
virtual void SetUniformVariables(vtkUniformVariables *variables)
vtkTimeStamp LastLinkTime
vtkUniformVariables * UniformVariables
void SetUniform1f(const char *name, float *val)
@ VTK_SHADER_PROGRAM2_LINK_FAILED
@ VTK_GEOMETRY_SHADER_OUT_TYPE_POINTS
vtkRenderWindow * GetContext()
bool HasGeometryShaders()
Tells if at least one of the shaders is a geometry shader.
void Restore()
Restore the previous shader program (or fixed-pipeline).
void PrintActiveUniformVariablesOnCout()
Call PrintActiveUniformVariables on cout.
void SetUniform1ft(const char *name, T *value)
bool HasTessellationEvaluationShaders()
Tells if at least one of the shaders is a tessellation evaluation shader.
void SetUniform1it(const char *name, T *value)
Convenience methods for copy/convert to supported type.
void SetUniform2ft(const char *name, T *value)
void SetUniform4it(const char *name, T *value)
@ VTK_GEOMETRY_SHADER_IN_TYPE_LINES
void SetUniformf(int loc, float val)
void SetUniform1ft(int loc, T *value)
void SetUniform3i(const char *name, int *val)
Interface class for querying and using OpenGL extensions.
@ VTK_GEOMETRY_SHADER_IN_TYPE_TRIANGLES
vtkShaderProgram2GeometryInType
size_t LastValidateLogCapacity
void SetUniform2i(int loc, int *val)
void SetUniform4f(int loc, float *val)
void SetUniform1i(int loc, int *val)
const char * GetLastValidateLog()
Return the log of the last call to IsValid as a string.
void SetUniform4f(const char *name, float *val)
void SetUniform4i(int loc, int *val)
void SetContext(vtkRenderWindow *context)
Get/Set the context.
void SendUniforms()
Send the uniform variables values to the program.
void RestoreFixedPipeline()
Force the current shader program to be the fixed-pipeline.
a simple class to control print indentation
void SetUniform4i(const char *name, int *val)
void UseProgram()
Simple direct use of the program without side affects and with error check.
int GetUniformLocation(const char *name)
Get a uniform's location.
bool IsValid()
Tell if the shader program is valid with the current OpenGL state.
@ VTK_GEOMETRY_SHADER_IN_TYPE_TRIANGLES_ADJACENCY
void PrintActiveUniformVariables(ostream &os, vtkIndent indent)
Introspection.
bool LoadRequiredExtensions(vtkRenderWindow *context)
Load the required OpenGL extentions.
@ VTK_GEOMETRY_SHADER_IN_TYPE_LINES_ADJACENCY
static vtkShaderProgram2 * New()
void SetUniform2f(int loc, float *val)
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void Use()
Use the shader program.
void SetUniform2it(const char *name, T *value)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
void SetUniform2i(const char *name, int *val)
void SetUniformf(const char *name, float val)
Set a uniform value directly.
void SetUniform4ft(int loc, T *value)
void SetUniform1it(int loc, T *value)
void SetUniform2ft(int loc, T *value)
@ VTK_GEOMETRY_SHADER_IN_TYPE_POINTS
static bool IsSupported(vtkRenderWindow *context)
Returns if the context supports the required extensions.
void SetUniform3it(int loc, T *value)
void SetUniformi(int loc, int val)
int GetLastBuildStatus()
Tells if the last build: failed during compilation of one of the shader, fails during link of the pro...
void SetUniform3ft(int loc, T *value)
create a window for renderers to draw into
virtual ~vtkShaderProgram2()
void SetUniform3it(const char *name, T *value)
const char * GetLastLinkLog()
Return the log of the last link as a string.
void SetUniform3f(int loc, float *val)
void SetUniform3f(const char *name, float *val)
@ VTK_GEOMETRY_SHADER_OUT_TYPE_LINE_STRIP
vtkShaderProgram2BuildStatus
void SetUniform1i(const char *name, int *val)
size_t LastLinkLogCapacity
void Build()
If not done yet, compile all the shaders and link the program.
void SetUniform4ft(const char *name, T *value)
vtkWeakPointer< vtkRenderWindow > Context
@ VTK_SHADER_PROGRAM2_COMPILE_FAILED
bool HasFragmentShaders()
Tells if at least one of the shaders is a fragment shader.
bool HasTessellationControlShaders()
Tells if at least one of the shaders is a tessellation control shader.