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 =========================================================================*/
21 #ifndef vtkShader_h
22 #define vtkShader_h
23 
24 #include "vtkRenderingOpenGL2Module.h" // for export macro
25 #include "vtkObject.h"
26 
27 #include <string> // For member variables.
28 #include <vector> // For member variables.
29 
37 class VTKRENDERINGOPENGL2_EXPORT vtkShader : public vtkObject
38 {
39 public:
40  static vtkShader *New();
41  vtkTypeMacro(vtkShader, vtkObject);
42  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
43 
44 
46  enum Type {
50  Unknown
51  };
52 
54  void SetType(Type type);
55 
57  Type GetType() const { return this->ShaderType; }
58 
60  void SetSource(const std::string &source);
61 
63  std::string GetSource() const { return this->Source; }
64 
66  std::string GetError() const { return this->Error; }
67 
69  int GetHandle() const { return this->Handle; }
70 
74  bool Compile();
75 
80  void Cleanup();
81 
82 protected:
83  vtkShader();
84  ~vtkShader() VTK_OVERRIDE;
85 
87  int Handle;
88  bool Dirty;
89 
92 
93 private:
94  vtkShader(const vtkShader&) VTK_DELETE_FUNCTION;
95  void operator=(const vtkShader&) VTK_DELETE_FUNCTION;
96 };
97 
98 
99 #endif
std::string GetError() const
Get the error message (empty if none) for the shader.
Definition: vtkShader.h:66
Type GetType() const
Get the shader type, typically Vertex or Fragment.
Definition: vtkShader.h:57
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Geometry shader.
Definition: vtkShader.h:49
Type
Available shader types.
Definition: vtkShader.h:46
std::string Error
Definition: vtkShader.h:91
Fragment shader.
Definition: vtkShader.h:48
bool Dirty
Definition: vtkShader.h:88
a simple class to control print indentation
Definition: vtkIndent.h:33
std::string Source
Definition: vtkShader.h:90
int Handle
Definition: vtkShader.h:87
Type ShaderType
Definition: vtkShader.h:86
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:37
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Vertex shader.
Definition: vtkShader.h:47
std::string GetSource() const
Get the source for the shader.
Definition: vtkShader.h:63
int GetHandle() const
Get the handle of the shader.
Definition: vtkShader.h:69