VTK
vtkShader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
24 #ifndef vtkShader_h
25 #define vtkShader_h
26 
27 #include "vtkRenderingOpenGL2Module.h" // for export macro
28 #include "vtkObject.h"
29 
30 #include <string> // For member variables.
31 #include <vector> // For member variables.
32 
40 class VTKRENDERINGOPENGL2_EXPORT vtkShader : public vtkObject
41 {
42 public:
43  static vtkShader *New();
44  vtkTypeMacro(vtkShader, vtkObject);
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
47 
49  enum Type {
53  Unknown
54  };
55 
57  void SetType(Type type);
58 
60  Type GetType() const { return this->ShaderType; }
61 
63  void SetSource(const std::string &source);
64 
66  std::string GetSource() const { return this->Source; }
67 
69  std::string GetError() const { return this->Error; }
70 
72  int GetHandle() const { return this->Handle; }
73 
77  bool Compile();
78 
83  void Cleanup();
84 
85 protected:
86  vtkShader();
87  ~vtkShader();
88 
90  int Handle;
91  bool Dirty;
92 
95 
96 private:
97  vtkShader(const vtkShader&) VTK_DELETE_FUNCTION;
98  void operator=(const vtkShader&) VTK_DELETE_FUNCTION;
99 };
100 
101 
102 #endif
Type GetType() const
Get the shader type, typically Vertex or Fragment.
Definition: vtkShader.h:60
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Geometry shader.
Definition: vtkShader.h:52
Type
Available shader types.
Definition: vtkShader.h:49
std::string Error
Definition: vtkShader.h:94
Fragment shader.
Definition: vtkShader.h:51
bool Dirty
Definition: vtkShader.h:91
a simple class to control print indentation
Definition: vtkIndent.h:39
int GetHandle() const
Get the handle of the shader.
Definition: vtkShader.h:72
std::string Source
Definition: vtkShader.h:93
std::string GetError() const
Get the error message (empty if none) for the shader.
Definition: vtkShader.h:69
int Handle
Definition: vtkShader.h:90
Type ShaderType
Definition: vtkShader.h:89
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Vertex or Fragment shader, combined into a ShaderProgram.
Definition: vtkShader.h:40
std::string GetSource() const
Get the source for the shader.
Definition: vtkShader.h:66
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Vertex shader.
Definition: vtkShader.h:50