1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkOpenGLProjectedTetrahedraMapper.cxx
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 =========================================================================*/
15 
16 #ifndef vtkVolumeShader_h
17 #define vtkVolumeShader_h
18 
19 #include <vtk_glew.h>
20 
21 #include <string>
22 #include <map>
23 
24 using namespace std;
25 
26 class vtkVolumeShader
27 {
28 public:
29     vtkVolumeShader(void);
30     ~vtkVolumeShader(void);
31     void LoadFromString(GLenum whichShader, const string& source);
32     void LoadFromFile(GLenum whichShader, const string& filename);
33     void CreateAndLinkProgram();
34     void Use();
35     void UnUse();
36     void AddAttribute(const string& attribute);
37     void AddUniform(const string& uniform);
GetProgram()38     unsigned int GetProgram()
39       {
40       return this->Program;
41       }
42 
43     //An indexer that returns the location of the attribute/uniform
44     GLuint operator[](const string& attribute);
45     GLuint operator()(const string& uniform);
46     void DeleteShaderProgram();
47 
48 private:
49     enum ShaderType {VERTEX_SHADER, FRAGMENT_SHADER, GEOMETRY_SHADER};
50     GLuint	Program;
51     int TotalShaders;
52     GLuint Shaders[3];//0->vertexshader, 1->fragmentshader, 2->geometryshader
53     map<string,GLuint> AttributeList;
54     map<string,GLuint> UniformLocationList;
55 };
56 
57 #endif // vtkVolumeShader_h
58 // VTK-HeaderTest-Exclude: vtkVolumeShader.h
59