15 #ifndef vtkShaderProgram_h
16 #define vtkShaderProgram_h
20 #include "vtkRenderingOpenGL2Module.h"
27 VTK_ABI_NAMESPACE_BEGIN
32 class VertexArrayObject;
55 vtkGetObjectMacro(VertexShader,
vtkShader);
63 vtkGetObjectMacro(FragmentShader,
vtkShader);
71 vtkGetObjectMacro(GeometryShader,
vtkShader);
79 vtkGetObjectMacro(ComputeShader,
vtkShader);
87 vtkGetObjectMacro(TessControlShader,
vtkShader);
95 vtkGetObjectMacro(TessEvaluationShader,
vtkShader);
111 vtkGetMacro(Compiled,
bool);
112 vtkSetMacro(Compiled,
bool);
113 vtkBooleanMacro(Compiled,
bool);
126 std::
string GetMD5Hash()
const {
return this->MD5Hash; }
128 void SetMD5Hash(const
std::
string& hash) { this->MD5Hash = hash; }
155 void ReleaseGraphicsResources(
vtkWindow* win);
167 bool EnableAttributeArray(
const char*
name);
173 bool DisableAttributeArray(
const char*
name);
190 bool UseAttributeArray(
const char*
name,
int offset,
size_t stride,
int elementType,
191 int elementTupleSize, NormalizeOption normalize);
211 bool SetAttributeArray(
212 const char*
name,
const T& array,
int tupleSize, NormalizeOption normalize);
215 bool SetUniformi(
const char*
name,
int v);
216 bool SetUniformf(
const char*
name,
float v);
217 bool SetUniform2i(
const char*
name,
const int v[2]);
218 bool SetUniform2f(
const char*
name,
const float v[2]);
219 bool SetUniform3f(
const char*
name,
const float v[3]);
220 bool SetUniform3f(
const char*
name,
const double v[3]);
221 bool SetUniform4f(
const char*
name,
const float v[4]);
222 bool SetUniform3uc(
const char*
name,
const unsigned char v[3]);
223 bool SetUniform4uc(
const char*
name,
const unsigned char v[4]);
226 bool SetUniformMatrix3x3(
const char*
name,
float* v);
227 bool SetUniformMatrix4x4(
const char*
name,
float* v);
230 bool SetUniform1iv(
const char*
name,
int count,
const int* f);
231 bool SetUniform1fv(
const char*
name,
int count,
const float* f);
232 bool SetUniform2fv(
const char*
name,
int count,
const float* f);
233 bool SetUniform2fv(
const char*
name,
int count,
const float (*f)[2]);
234 bool SetUniform3fv(
const char* name,
int count,
const float* f);
235 bool SetUniform3fv(
const char* name,
int count,
const float (*f)[3]);
236 bool SetUniform4fv(
const char* name,
int count,
const float* f);
237 bool SetUniform4fv(
const char* name,
int count,
const float (*f)[4]);
238 bool SetUniformMatrix4x4v(
const char* name,
int count,
float* v);
252 bool SetUniformi(
int location,
int v);
253 bool SetUniformf(
int location,
float v);
254 bool SetUniform3f(
int location,
const float v[3]);
255 bool SetUniform3f(
int location,
const double v[3]);
256 bool SetUniform4f(
int location,
const float v[4]);
257 bool SetUniform1fv(
int location,
int count,
const float* f);
258 bool SetUniform4fv(
int location,
int count,
const float* f);
261 bool SetUniformMatrix3x3(
int location,
float* v);
262 bool SetUniformMatrix4x4(
int location,
float* v);
263 bool SetUniformMatrix4x4v(
int location,
int count,
float* v);
276 vtkSetMacro(NumberOfOutputs,
unsigned int);
289 static bool Substitute(
303 static bool Substitute(
311 bool IsUniformUsed(
const char*);
317 bool IsAttributeUsed(
const char* name);
327 bool operator()(
const char* a,
const char* b)
const {
return strcmp(a, b) < 0; }
348 vtkSetFilePathMacro(FileNamePrefixForDebugging);
349 vtkGetFilePathMacro(FileNamePrefixForDebugging);
370 int FindUniform(
const char* name);
371 int FindAttributeArray(
const char* name);
391 bool AttachShader(
const vtkShader* shader);
398 bool DetachShader(
const vtkShader* shader);
403 virtual int CompileShader();
434 bool SetAttributeArrayInternal(
464 friend class VertexArrayObject;
471 void ReportShaderError(
vtkShader* shader);
485 bool UniformValueChanged(
int location,
const void*
data, std::size_t nbytes);
487 char* FileNamePrefixForDebugging;
488 std::vector<std::vector<unsigned char>> UniformValueCache;
490 unsigned int LinkCount = 0;
493 VTK_ABI_NAMESPACE_END
std::map< const char *, int, cmp_str > UniformLocs
int GetHandle() const
Get the handle of the shader program.
vtkShader * ComputeShader
abstract base class for most VTK objects
represent and manipulate 4x4 transformation matrices
std::map< const char *, int, cmp_str > AttributeLocs
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTransformFeedback * TransformFeedback
vtkTypeUInt32 vtkMTimeType
unsigned int NumberOfOutputs
int TessControlShaderHandle
manage Shader Programs within a context
bool isBound() const
Check if the program is currently bound, or not.
int TessEvaluationShaderHandle
The values range across the limits of the numeric type.
bool operator()(const char *a, const char *b) const
vtkShader * TessEvaluationShader
void SetHash(const std::string &hash)
window superclass for vtkRenderWindow
#define VTK_DEPRECATED_IN_9_6_0(reason)
a simple class to control print indentation
vtkShader * GeometryShader
vtkShader * FragmentShader
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
NormalizeOption
Options for attribute normalization.
std::string GetHash() const
Set/Get the hash of this program.
Vertex or Fragment shader, combined into a ShaderProgram.
std::map< int, vtkMTimeType > UniformGroupMTimes
std::string GetError() const
Get the error message (empty if none) for the shader program.
unsigned int GetLinkCount() const
Number of times this program has been (re)linked.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3x3 transformation matrices
UniformGroups
Set/Get times that can be used to track when a set of uniforms was last updated.
The ShaderProgram uses one or more Shader objects.
vtkShader * TessControlShader