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 =========================================================================*/
41 #ifndef vtkShader2_h
42 #define vtkShader2_h
43 
44 #include "vtkWeakPointer.h" // for ren context
45 #include "vtkRenderingOpenGLModule.h" // For export macro
46 #include "vtkObject.h"
47 
48 // Values for GetType()/SetType()
50 {
52  VTK_SHADER_TYPE_TESSELLATION_CONTROL = 3, // new, not supported yet
53  VTK_SHADER_TYPE_TESSELLATION_EVALUATION = 4, // new, not supported yet
56 };
57 
58 class vtkRenderWindow;
60 
62 {
63 public:
64  static vtkShader2 *New();
65  vtkTypeMacro(vtkShader2,vtkObject);
66  void PrintSelf(ostream &os, vtkIndent indent);
67 
70  static bool IsSupported(vtkRenderWindow *context);
71 
73 
75  vtkGetStringMacro(SourceCode);
76  vtkSetStringMacro(SourceCode);
78 
80 
85  vtkGetMacro(Type,int);
87 
89 
94  vtkSetMacro(Type,int);
96 
98  const char *GetTypeAsString();
99 
103  void Compile();
104 
107  bool GetLastCompileStatus();
108 
111  const char *GetLastCompileLog();
112 
114 
118  void SetContext(vtkRenderWindow *context);
119  vtkRenderWindow *GetContext();
121 
123  virtual void ReleaseGraphicsResources();
124 
126 
127  vtkGetMacro(Id,unsigned int);
129 
131 
133  vtkGetObjectMacro(UniformVariables,vtkUniformVariables);
134  virtual void SetUniformVariables(vtkUniformVariables *variables);
136 
137 protected:
139  vtkShader2();
140 
142  virtual ~vtkShader2();
143 
145  bool LoadRequiredExtensions(vtkRenderWindow *context);
146 
147  char *SourceCode;
148  int Type;
149 
150  unsigned int Id; // actually GLuint. Initial value is 0.
151 
152  bool LastCompileStatus; // Initial value is false.
153  char *LastCompileLog; // Initial value is the empty string ""='\0'.
154  size_t LastCompileLogCapacity; // Initial value is 8.
155 
157  vtkUniformVariables *UniformVariables; // Initial values is an empty list
158 
160 
163 
164 private:
165  vtkShader2(const vtkShader2&); // Not implemented.
166  void operator=(const vtkShader2&); // Not implemented.
167 };
168 
169 #endif
GLSL Shader.
Definition: vtkShader2.h:61
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkWeakPointer< vtkRenderWindow > Context
Definition: vtkShader2.h:159
GLSL uniform variables.
vtkShader2Type
Definition: vtkShader2.h:49
record modification and/or execution time
Definition: vtkTimeStamp.h:34
bool ExtensionsLoaded
Definition: vtkShader2.h:161
bool LastCompileStatus
Definition: vtkShader2.h:152
vtkUniformVariables * UniformVariables
Definition: vtkShader2.h:157
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTKRENDERINGOPENGL_EXPORT
size_t LastCompileLogCapacity
Definition: vtkShader2.h:154
char * SourceCode
Definition: vtkShader2.h:147
unsigned int Id
Definition: vtkShader2.h:150
vtkTimeStamp LastCompileTime
Definition: vtkShader2.h:156
create a window for renderers to draw into
char * LastCompileLog
Definition: vtkShader2.h:153
bool SupportGeometryShader
Definition: vtkShader2.h:162
static vtkObject * New()