gl_glsl_shader.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00033 #ifndef __gl_glsl_shader__header__
00034 #define __gl_glsl_shader__header__
00035
00036 #include "gpucalc/shader.h"
00037
00038 #include <GL/glew.h>
00039
00040 namespace gpucalc
00041 {
00042
00043 const char _GLGLSLShaderClassName [] = "GLGLSLShader";
00044
00045 class _GpuCalcPrivate GLGLSLShader: public Shader
00046 {
00047
00048 OBJ_DISABLE_COPY(GLGLSLShader)
00049
00050
00051 friend class GLGLSLShaderSystem;
00052
00053
00054 public:
00055 GLGLSLShader(const std::string & ShaderName, ShaderSystem * system);
00056
00057
00058 ~GLGLSLShader();
00059
00060
00061 void setSource(const std::string & ShaderSource);
00062
00063
00064 std::string getSource() const
00065 {
00066 return mShaderSource;
00067 }
00068
00069
00073 void addUniform(Uniform * uniform);
00074
00075
00076 void removeUniform(Uniform * uniform);
00077
00078
00079 void compile(const std::string & Parameters = std::string());
00080
00081
00082 bool isCompiled() const
00083 {
00084 return mIsCompiled;
00085 }
00086
00087
00088 void validate();
00089
00090
00091 void preCompute();
00092
00093
00094 bool isDebugEnabled() const
00095 {
00096 return mIsDebug;
00097 }
00098
00099
00100 std::string getLanguageID() const
00101 {
00102 return "glsl";
00103 }
00104
00105
00106 private:
00107 GLhandleARB mGLSLProgramID;
00108
00109
00110 GLhandleARB mGLSLFragmentShaderID;
00111
00112
00113 GLint mMultiTextureNumber;
00114
00115
00116 typedef std::list<Uniform *> UniformVector;
00117 UniformVector mUniformVector;
00118
00119
00120 bool mIsCompiled;
00121
00122
00123 bool mIsDebug;
00124
00125
00126 std::string mShaderSource;
00127
00128
00129 std::string mShaderCompilerParams;
00130
00131
00132 void compileStatus();
00133
00134
00135 void linkStatus();
00136
00137
00138 void ShaderInfoLog();
00139
00140
00141 void ProgramInfoLog();
00142
00143
00144 GLint getUniformLocation(const std::string & Name);
00145
00146
00147 void setUniformVariable(Uniform * uniform);
00148
00149
00150 void setUniformSampler(Uniform * uniform);
00151 };
00152 }
00153
00154 #endif