VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/VolumeOpenGLNew/vtkVolumeShader.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkOpenGLProjectedTetrahedraMapper.cxx
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 
00016 #ifndef vtkVolumeShader_h
00017 #define vtkVolumeShader_h
00018 
00019 #include <vtk_glew.h>
00020 
00021 #include <string>
00022 #include <map>
00023 
00024 using namespace std;
00025 
00026 class vtkVolumeShader
00027 {
00028 public:
00029     vtkVolumeShader(void);
00030     ~vtkVolumeShader(void);
00031     void LoadFromString(GLenum whichShader, const string& source);
00032     void LoadFromFile(GLenum whichShader, const string& filename);
00033     void CreateAndLinkProgram();
00034     void Use();
00035     void UnUse();
00036     void AddAttribute(const string& attribute);
00037     void AddUniform(const string& uniform);
00038     unsigned int GetProgram()
00039       {
00040       return this->Program;
00041       }
00042 
00043     //An indexer that returns the location of the attribute/uniform
00044     GLuint operator[](const string& attribute);
00045     GLuint operator()(const string& uniform);
00046     void DeleteShaderProgram();
00047 
00048 private:
00049     enum ShaderType {VERTEX_SHADER, FRAGMENT_SHADER, GEOMETRY_SHADER};
00050     GLuint  Program;
00051     int TotalShaders;
00052     GLuint Shaders[3];//0->vertexshader, 1->fragmentshader, 2->geometryshader
00053     map<string,GLuint> AttributeList;
00054     map<string,GLuint> UniformLocationList;
00055 };
00056 
00057 #endif // vtkVolumeShader_h
00058 // VTK-HeaderTest-Exclude: vtkVolumeShader.h