VTK
vtkShader2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkShader2.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
39 #ifndef vtkShader2_h
40 #define vtkShader2_h
41 
42 #include "vtkWeakPointer.h" // for ren context
43 #include "vtkRenderingOpenGLModule.h" // For export macro
44 #include "vtkObject.h"
45 
46 // Values for GetType()/SetType()
48 {
50  VTK_SHADER_TYPE_TESSELLATION_CONTROL = 3, // new, not supported yet
51  VTK_SHADER_TYPE_TESSELLATION_EVALUATION = 4, // new, not supported yet
54 };
55 
56 class vtkRenderWindow;
58 
59 class VTKRENDERINGOPENGL_EXPORT vtkShader2 : public vtkObject
60 {
61 public:
62  static vtkShader2 *New();
63  vtkTypeMacro(vtkShader2,vtkObject);
64  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
65 
70  static bool IsSupported(vtkRenderWindow *context);
71 
73 
77  vtkGetStringMacro(SourceCode);
78  vtkSetStringMacro(SourceCode);
80 
82 
90  vtkGetMacro(Type,int);
92 
94 
103  vtkSetMacro(Type,int);
105 
109  const char *GetTypeAsString();
110 
117  void Compile();
118 
123  bool GetLastCompileStatus();
124 
130  const char *GetLastCompileLog();
131 
133 
139  void SetContext(vtkRenderWindow *context);
140  vtkRenderWindow *GetContext();
142 
146  virtual void ReleaseGraphicsResources();
147 
149 
152  vtkGetMacro(Id,unsigned int);
154 
156 
160  vtkGetObjectMacro(UniformVariables,vtkUniformVariables);
161  virtual void SetUniformVariables(vtkUniformVariables *variables);
163 
164 protected:
168  vtkShader2();
169 
173  ~vtkShader2() VTK_OVERRIDE;
174 
178  bool LoadRequiredExtensions(vtkRenderWindow *context);
179 
180  char *SourceCode;
181  int Type;
182 
183  unsigned int Id; // actually GLuint. Initial value is 0.
184 
185  bool LastCompileStatus; // Initial value is false.
186  char *LastCompileLog; // Initial value is the empty string ""='\0'.
187  size_t LastCompileLogCapacity; // Initial value is 8.
188 
189  vtkTimeStamp LastCompileTime;
190  vtkUniformVariables *UniformVariables; // Initial values is an empty list
191 
193 
194  bool ExtensionsLoaded;
195  bool SupportGeometryShader;
196 
197 private:
198  vtkShader2(const vtkShader2&) VTK_DELETE_FUNCTION;
199  void operator=(const vtkShader2&) VTK_DELETE_FUNCTION;
200 };
201 
202 #endif
GLSL Shader.
Definition: vtkShader2.h:59
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.
GLSL uniform variables.
vtkShader2Type
Definition: vtkShader2.h:47
record modification and/or execution time
Definition: vtkTimeStamp.h:32
a simple class to control print indentation
Definition: vtkIndent.h:33
a weak reference to a vtkObject.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
create a window for renderers to draw into
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...