00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00073 #ifndef __vtkGLSLShader_h
00074 #define __vtkGLSLShader_h
00075
00076 #include "vtkShader.h"
00077
00078 class vtkActor;
00079 class vtkRenderer;
00080 class vtkProperty;
00081 class vtkLight;
00082 class vtkCamera;
00083 class vtkRenderWindow;
00084
00085
00086
00087 class VTK_RENDERING_EXPORT vtkGLSLShader : public vtkShader
00088 {
00089 public:
00090 static vtkGLSLShader *New();
00091 vtkTypeMacro(vtkGLSLShader, vtkShader);
00092 void PrintSelf(ostream &os, vtkIndent indent);
00093
00098 virtual int Compile();
00099
00101 unsigned int GetHandle() { return this->Shader; }
00102
00104
00106 vtkSetMacro( Program, unsigned int );
00107 vtkGetMacro( Program, unsigned int );
00109
00113 virtual void ReleaseGraphicsResources(vtkWindow *);
00114 protected:
00115 vtkGLSLShader();
00116 virtual ~vtkGLSLShader();
00117
00118
00119 unsigned int Program;
00120 unsigned int Shader;
00121
00122 int IsShader();
00123 int IsCompiled();
00124
00126 void LoadShader();
00127
00129
00130 virtual void SetUniformParameter(const char* name, int numValues, const int* value);
00131 virtual void SetUniformParameter(const char* name, int numValues, const float* value);
00132 virtual void SetUniformParameter(const char* name, int numValues, const double* value);
00134
00136
00137 virtual void SetMatrixParameter(const char* name, int numValues,
00138 int order, const float* value);
00139 virtual void SetMatrixParameter(const char* name, int numValues,
00140 int order, const double* value);
00141 virtual void SetMatrixParameter(const char* name, const char* state_matix_type,
00142 const char* transform_type);
00144
00145 virtual void SetSamplerParameter(const char* name, vtkTexture* texture,
00146 int textureIndex);
00147 private:
00148 vtkGLSLShader(const vtkGLSLShader&);
00149 void operator=(const vtkGLSLShader&);
00150
00151 int GetUniformLocation( const char* name );
00152 };
00153 #endif //__vtkGLSLShader_h