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 "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 
58 
60 {
61 public:
62  static vtkShader2 *New();
63  vtkTypeMacro(vtkShader2,vtkObject);
64  void PrintSelf(ostream &os, vtkIndent indent);
65 
67 
68  static bool IsSupported(vtkOpenGLRenderWindow *context);
69  static bool LoadExtensions(vtkOpenGLRenderWindow *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(vtkOpenGLRenderWindow *context);
119  vtkGetObjectMacro(Context,vtkOpenGLRenderWindow);
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 
144  char *SourceCode;
145  int Type;
146 
147  unsigned int Id; // actually GLuint. Initial value is 0.
148 
149  bool LastCompileStatus; // Initial value is false.
150  char *LastCompileLog; // Initial value is the empty string ""='\0'.
151  size_t LastCompileLogCapacity; // Initial value is 8.
152 
154  vtkUniformVariables *UniformVariables; // Initial values is an empty list
156 
159 
160 private:
161  vtkShader2(const vtkShader2&); // Not implemented.
162  void operator=(const vtkShader2&); // Not implemented.
163 };
164 
165 #endif