00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined(__INCLUDE_GLSLShaderSetuph_INCLUDE__)
00022 #define __INCLUDE_GLSLShaderSetuph_INCLUDE__
00023
00024 #include <GLSL/GLSLShader.h>
00025 #include <GLSL/GLSLProgram.h>
00026
00027 class GLSLShaderSetup
00028 {
00029 public:
00030
00031 GLSLShaderSetup(
00032 const std::string &filename_vshader,
00033 const std::string &filename_fshader,
00034 const GLSLShader::defines_list& dl = GLSLShader::defines_list());
00035 ~GLSLShaderSetup();
00036
00037
00038 void use() const { prog_.use(); }
00039
00040
00041 static void use_fixed() { GLSLProgram::use_fixed(); }
00042
00043
00044 void set_gl_texture(GLTexture &tex, const char *texname, unsigned texunitnr) const
00045 {
00046 prog_.set_gl_texture(tex, texname, texunitnr);
00047 }
00048 void set_gl_texture(GLShadowFrameBuffer &tex, const char *texname, unsigned texunitnr) const
00049 {
00050 prog_.set_gl_texture(tex, texname, texunitnr);
00051 }
00052 void set_gl_texture_unit(const char *texname, unsigned texunitnr) const
00053 {
00054 prog_.set_gl_texture_unit(texname, texunitnr);
00055 }
00056
00057
00058 void set_uniform(const char *name, const Vector& value) const
00059 {
00060 prog_.set_uniform(name, value);
00061 }
00062 void set_uniform(const char *name, const float value) const
00063 {
00064 prog_.set_uniform(name, value);
00065 }
00066
00067
00068 unsigned get_vertex_attrib_index(const char *name) const
00069 {
00070 return prog_.get_vertex_attrib_index(name);
00071 }
00072
00073 protected:
00074 GLSLShader vs_, fs_;
00075 GLSLProgram prog_;
00076
00077 private:
00078 GLSLShaderSetup(const GLSLShaderSetup&);
00079 GLSLShaderSetup& operator= (const GLSLShaderSetup&);
00080 };
00081
00082 #endif // __INCLUDE_GLSLShaderSetuph_INCLUDE__