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 "vtkRenderingOpenGLModule.h" // For export macro
45 #include "vtkObject.h"
46 
47 // Values for GetType()/SetType()
49 {
51  VTK_SHADER_TYPE_TESSELLATION_CONTROL=3, // new, not supported yet
52  VTK_SHADER_TYPE_TESSELLATION_EVALUATION=4, // new, not supported yet
55 };
56 
59 
60 class VTKRENDERINGOPENGL_EXPORT vtkShader2 : public vtkObject
61 {
62 public:
63  static vtkShader2 *New();
64  vtkTypeMacro(vtkShader2,vtkObject);
65  void PrintSelf(ostream &os, vtkIndent indent);
66 
68 
69  static bool IsSupported(vtkOpenGLRenderWindow *context);
70  static bool LoadExtensions(vtkOpenGLRenderWindow *context);
72 
74 
76  vtkGetStringMacro(SourceCode);
77  vtkSetStringMacro(SourceCode);
79 
81 
86  vtkGetMacro(Type,int);
88 
90 
95  vtkSetMacro(Type,int);
97 
99  const char *GetTypeAsString();
100 
104  void Compile();
105 
108  bool GetLastCompileStatus();
109 
112  const char *GetLastCompileLog();
113 
115 
119  void SetContext(vtkOpenGLRenderWindow *context);
120  vtkGetObjectMacro(Context,vtkOpenGLRenderWindow);
122 
124  virtual void ReleaseGraphicsResources();
125 
127 
128  vtkGetMacro(Id,unsigned int);
130 
132 
134  vtkGetObjectMacro(UniformVariables,vtkUniformVariables);
135  virtual void SetUniformVariables(vtkUniformVariables *variables);
137 
138 protected:
140  vtkShader2();
141 
143  virtual ~vtkShader2();
144 
145  char *SourceCode;
146  int Type;
147 
148  unsigned int Id; // actually GLuint. Initial value is 0.
149 
150  bool LastCompileStatus; // Initial value is false.
151  char *LastCompileLog; // Initial value is the empty string ""='\0'.
152  size_t LastCompileLogCapacity; // Initial value is 8.
153 
155  vtkUniformVariables *UniformVariables; // Initial values is an empty list
157 
160 
161 private:
162  vtkShader2(const vtkShader2&); // Not implemented.
163  void operator=(const vtkShader2&); // Not implemented.
164 };
165 
166 #endif