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
59class vtkRenderWindow;
61
62class VTKRENDERINGOPENGL_EXPORT vtkShader2 : public vtkObject
63{
64public:
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
127
133 const char *GetLastCompileLog();
134
136
145
150
152
155 vtkGetMacro(Id,unsigned int);
157
159
163 vtkGetObjectMacro(UniformVariables,vtkUniformVariables);
164 virtual void SetUniformVariables(vtkUniformVariables *variables);
166
167protected:
172
176 virtual ~vtkShader2();
177
182
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
200private:
201 vtkShader2(const vtkShader2&) VTK_DELETE_FUNCTION;
202 void operator=(const vtkShader2&) VTK_DELETE_FUNCTION;
203};
204
205#endif
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
create a window for renderers to draw into
GLSL Shader.
Definition: vtkShader2.h:63
size_t LastCompileLogCapacity
Definition: vtkShader2.h:190
unsigned int Id
Definition: vtkShader2.h:186
bool ExtensionsLoaded
Definition: vtkShader2.h:197
vtkTimeStamp LastCompileTime
Definition: vtkShader2.h:192
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkRenderWindow * GetContext()
static bool IsSupported(vtkRenderWindow *context)
Returns if the context supports the required extensions.
virtual ~vtkShader2()
Destructor.
bool LastCompileStatus
Definition: vtkShader2.h:188
bool GetLastCompileStatus()
Tells if the last call to compile succeeded (true) or not (false).
bool LoadRequiredExtensions(vtkRenderWindow *context)
Load the required OpenGL extensions.
virtual void SetUniformVariables(vtkUniformVariables *variables)
static vtkShader2 * New()
vtkUniformVariables * UniformVariables
Definition: vtkShader2.h:193
const char * GetLastCompileLog()
Return the log of the last call to compile as a string.
char * LastCompileLog
Definition: vtkShader2.h:189
void SetContext(vtkRenderWindow *context)
Get/Set the context.
bool SupportGeometryShader
Definition: vtkShader2.h:198
char * SourceCode
Definition: vtkShader2.h:183
vtkWeakPointer< vtkRenderWindow > Context
Definition: vtkShader2.h:195
vtkShader2()
Default constructor.
virtual void ReleaseGraphicsResources()
Release OpenGL resource (shader id).
const char * GetTypeAsString()
Return the shader type as a string.
void Compile()
Compile the shader code.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
GLSL uniform variables.
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkShader2Type
Definition: vtkShader2.h:51
@ VTK_SHADER_TYPE_FRAGMENT
Definition: vtkShader2.h:56
@ VTK_SHADER_TYPE_TESSELLATION_CONTROL
Definition: vtkShader2.h:53
@ VTK_SHADER_TYPE_VERTEX
Definition: vtkShader2.h:52
@ VTK_SHADER_TYPE_GEOMETRY
Definition: vtkShader2.h:55
@ VTK_SHADER_TYPE_TESSELLATION_EVALUATION
Definition: vtkShader2.h:54