00001 #ifndef VOLPROGRAM_H 00002 #define VOLPROGRAM_H 00003 00004 #include <glew.h> 00005 #include <string> 00006 00008 class VolProgram { 00009 public: 00011 enum Mode { 00012 M_SLICE, 00013 M_3D_COLOR_CUBE, 00014 M_3D_RAYCAST 00015 }; 00016 00017 public: 00019 00023 explicit VolProgram(const char *name); 00024 ~VolProgram(); 00025 00027 void SetMode(Mode mode); 00028 00030 void SetVolumeTexture(GLuint texture); 00031 00033 void SetBackAndFrontTextures(GLuint back, GLuint front); 00034 00036 void SetTransferFunctionTexture(GLuint tex); 00037 00039 void Use(); 00040 00041 private: 00043 struct CompileSettings { 00044 std::string mode; 00045 }; 00046 00048 00052 GLuint CompileProgram(const char *name, const CompileSettings& settings) const; 00053 00054 void RecompileWhenRequired(); 00055 00056 private: 00059 GLuint program_; 00060 GLuint volume_texture_; 00061 GLuint front_texture_; 00062 GLuint back_texture_; 00063 GLuint transfer_texture_; 00064 00065 00066 Mode mode_; 00067 bool recompile_; 00068 std::string progname_; 00069 }; 00070 00071 #endif