00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00038 #ifndef __vtkShader2_h
00039 #define __vtkShader2_h
00040
00041 #include "vtkObject.h"
00042
00043
00044 enum vtkShader2Type
00045 {
00046 VTK_SHADER_TYPE_VERTEX=0,
00047 VTK_SHADER_TYPE_TESSELLATION_CONTROL=3,
00048 VTK_SHADER_TYPE_TESSELLATION_EVALUATION=4,
00049 VTK_SHADER_TYPE_GEOMETRY=1,
00050 VTK_SHADER_TYPE_FRAGMENT=2
00051 };
00052
00053 class vtkOpenGLRenderWindow;
00054 class vtkUniformVariables;
00055
00056 class VTK_RENDERING_EXPORT vtkShader2 : public vtkObject
00057 {
00058 public:
00059 static vtkShader2 *New();
00060 vtkTypeRevisionMacro(vtkShader2,vtkObject);
00061 void PrintSelf(ostream &os, vtkIndent indent);
00062
00064
00065 static bool IsSupported(vtkOpenGLRenderWindow *context);
00066 static bool LoadExtensions(vtkOpenGLRenderWindow *context);
00068
00070
00072 vtkGetStringMacro(SourceCode);
00073 vtkSetStringMacro(SourceCode);
00075
00077
00082 vtkGetMacro(Type,int);
00084
00086
00091 vtkSetMacro(Type,int);
00093
00095 const char *GetTypeAsString();
00096
00100 void Compile();
00101
00104 bool GetLastCompileStatus();
00105
00108 const char *GetLastCompileLog();
00109
00111
00115 void SetContext(vtkOpenGLRenderWindow *context);
00116 vtkGetObjectMacro(Context,vtkOpenGLRenderWindow);
00118
00120 virtual void ReleaseGraphicsResources();
00121
00123
00124 vtkGetMacro(Id,unsigned int);
00126
00128
00130 vtkGetObjectMacro(UniformVariables,vtkUniformVariables);
00131 virtual void SetUniformVariables(vtkUniformVariables *variables);
00133
00134 protected:
00136 vtkShader2();
00137
00139 virtual ~vtkShader2();
00140
00141 char *SourceCode;
00142 int Type;
00143
00144 unsigned int Id;
00145
00146 bool LastCompileStatus;
00147 char *LastCompileLog;
00148 size_t LastCompileLogCapacity;
00149
00150 vtkTimeStamp LastCompileTime;
00151 vtkUniformVariables *UniformVariables;
00152 vtkOpenGLRenderWindow *Context;
00153
00154 bool ExtensionsLoaded;
00155 bool SupportGeometryShader;
00156
00157 private:
00158 vtkShader2(const vtkShader2&);
00159 void operator=(const vtkShader2&);
00160 };
00161
00162 #endif