21 #ifndef vtkShaderProgram_h
22 #define vtkShaderProgram_h
24 #include "vtkRenderingOpenGL2Module.h"
34 class VertexArrayObject;
55 vtkGetObjectMacro(VertexShader,
vtkShader);
63 vtkGetObjectMacro(FragmentShader,
vtkShader);
71 vtkGetObjectMacro(GeometryShader,
vtkShader);
87 vtkGetMacro(Compiled,
bool);
124 void ReleaseGraphicsResources(
vtkWindow *win);
136 bool EnableAttributeArray(
const char *
name);
142 bool DisableAttributeArray(
const char *
name);
159 bool UseAttributeArray(
const char *
name,
int offset,
size_t stride,
160 int elementType,
int elementTupleSize,
161 NormalizeOption normalize);
181 bool SetAttributeArray(
const char *
name,
const T &array,
182 int tupleSize, NormalizeOption normalize);
185 bool SetUniformi(
const char *
name,
int v);
186 bool SetUniformf(
const char *
name,
float v);
187 bool SetUniform2i(
const char *
name,
const int v[2]);
188 bool SetUniform2f(
const char *
name,
const float v[2]);
189 bool SetUniform3f(
const char *
name,
const float v[3]);
190 bool SetUniform4f(
const char *
name,
const float v[4]);
191 bool SetUniform3uc(
const char *
name,
const unsigned char v[3]);
192 bool SetUniform4uc(
const char *
name,
const unsigned char v[4]);
195 bool SetUniformMatrix3x3(
const char *
name,
float *v);
196 bool SetUniformMatrix4x4(
const char *
name,
float *v);
199 bool SetUniform1iv(
const char *
name,
const int count,
const int *f);
200 bool SetUniform1fv(
const char *
name,
const int count,
const float *f);
201 bool SetUniform2fv(
const char *
name,
const int count,
const float (*f)[2]);
202 bool SetUniform3fv(
const char *name,
const int count,
const float (*f)[3]);
203 bool SetUniform4fv(
const char *name,
const int count,
const float (*f)[4]);
204 bool SetUniformMatrix4x4v(
const char *name,
const int count,
float *v);
215 static bool Substitute(
226 bool IsUniformUsed(
const char *);
232 bool IsAttributeUsed(
const char *name);
244 return strcmp(a, b) < 0;
266 vtkSetStringMacro(FileNamePrefixForDebugging);
288 bool AttachShader(const
vtkShader *shader);
295 bool DetachShader(const
vtkShader *shader);
300 virtual
int CompileShader();
328 bool SetAttributeArrayInternal(const
char *name,
void *buffer,
329 int type,
int tupleSize,
332 int VertexShaderHandle;
333 int FragmentShaderHandle;
334 int GeometryShaderHandle;
344 unsigned int NumberOfOutputs;
351 std::map<const
char *,
int,
cmp_str> AttributeLocs;
352 std::map<const
char *,
int,
cmp_str> UniformLocs;
354 friend class VertexArrayObject;
357 int FindAttributeArray(const
char *name);
358 int FindUniform(const
char *name);
363 char* FileNamePrefixForDebugging;
int GetHandle() const
Get the handle of the shader program.
abstract base class for most VTK objects
represent and manipulate 4x4 transformation matrices
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
manage Shader Programs within a context
bool isBound() const
Check if the program is currently bound, or not.
The values range across the limits of the numeric type.
std::string replace(std::string source, const std::string &search, const std::string &replace, bool all)
bool operator()(const char *a, const char *b) const
void SetMD5Hash(const std::string &hash)
window superclass for vtkRenderWindow
a simple class to control print indentation
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
NormalizeOption
Options for attribute normalization.
std::string GetMD5Hash() const
Set/Get the md5 hash of this program.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Vertex or Fragment shader, combined into a ShaderProgram.
std::string GetError() const
Get the error message (empty if none) for the shader program.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
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
The ShaderProgram uses one or more Shader objects.