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 =========================================================================*/
42 #ifndef vtkShader2_h
43 #define vtkShader2_h
44 
45 #include "vtkWeakPointer.h" // for ren context
46 #include "vtkRenderingOpenGLModule.h" // For export macro
47 #include "vtkObject.h"
48 
49 // Values for GetType()/SetType()
51 {
53  VTK_SHADER_TYPE_TESSELLATION_CONTROL = 3, // new, not supported yet
54  VTK_SHADER_TYPE_TESSELLATION_EVALUATION = 4, // new, not supported yet
57 };
58 
59 class vtkRenderWindow;
61 
62 class VTKRENDERINGOPENGL_EXPORT vtkShader2 : public vtkObject
63 {
64 public:
65  static vtkShader2 *New();
66  vtkTypeMacro(vtkShader2,vtkObject);
67  void PrintSelf(ostream &os, vtkIndent indent);
68 
73  static bool IsSupported(vtkRenderWindow *context);
74 
76 
80  vtkGetStringMacro(SourceCode);
81  vtkSetStringMacro(SourceCode);
83 
85 
93  vtkGetMacro(Type,int);
95 
97 
106  vtkSetMacro(Type,int);
108 
112  const char *GetTypeAsString();
113 
120  void Compile();
121 
126  bool GetLastCompileStatus();
127 
133  const char *GetLastCompileLog();
134 
136 
142  void SetContext(vtkRenderWindow *context);
143  vtkRenderWindow *GetContext();
145 
149  virtual void ReleaseGraphicsResources();
150 
152 
155  vtkGetMacro(Id,unsigned int);
157 
159 
163  vtkGetObjectMacro(UniformVariables,vtkUniformVariables);
164  virtual void SetUniformVariables(vtkUniformVariables *variables);
166 
167 protected:
171  vtkShader2();
172 
176  virtual ~vtkShader2();
177 
181  bool LoadRequiredExtensions(vtkRenderWindow *context);
182 
183  char *SourceCode;
184  int Type;
185 
186  unsigned int Id; // actually GLuint. Initial value is 0.
187 
188  bool LastCompileStatus; // Initial value is false.
189  char *LastCompileLog; // Initial value is the empty string ""='\0'.
190  size_t LastCompileLogCapacity; // Initial value is 8.
191 
193  vtkUniformVariables *UniformVariables; // Initial values is an empty list
194 
196 
199 
200 private:
201  vtkShader2(const vtkShader2&) VTK_DELETE_FUNCTION;
202  void operator=(const vtkShader2&) VTK_DELETE_FUNCTION;
203 };
204 
205 #endif
GLSL Shader.
Definition: vtkShader2.h:62
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkWeakPointer< vtkRenderWindow > Context
Definition: vtkShader2.h:195
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:50
record modification and/or execution time
Definition: vtkTimeStamp.h:35
bool ExtensionsLoaded
Definition: vtkShader2.h:197
bool LastCompileStatus
Definition: vtkShader2.h:188
vtkUniformVariables * UniformVariables
Definition: vtkShader2.h:193
a simple class to control print indentation
Definition: vtkIndent.h:39
size_t LastCompileLogCapacity
Definition: vtkShader2.h:190
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
char * SourceCode
Definition: vtkShader2.h:183
unsigned int Id
Definition: vtkShader2.h:186
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkTimeStamp LastCompileTime
Definition: vtkShader2.h:192
create a window for renderers to draw into
char * LastCompileLog
Definition: vtkShader2.h:189
bool SupportGeometryShader
Definition: vtkShader2.h:198
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...