00001 #include "common.h"
00002 #include "AbstractShader.h"
00003
00005
00012 class PostProcessingShaderObj
00013 {
00014 public:
00015 GLuint shaderID;
00016 GLuint Texture;
00017 GLuint lightPos;
00018 GLuint weight;
00019 GLuint exposure;
00020 GLuint density;
00021 GLuint decay;
00022 };
00023
00025
00031 class PostProcessingShader : public AbstractShader
00032 {
00033 public:
00037 PostProcessingShader()
00038 {
00039 gTransformQuadric = createShader("ls.vert","ls.frag");
00040 };
00041
00045 ~PostProcessingShader()
00046 {
00047 glDeleteShader(gTransformQuadric.shaderID);
00048 };
00049
00056 PostProcessingShaderObj createShader(const char* vertexshadername, const char* fragmentshadername)
00057 {
00058 PostProcessingShaderObj shaderID;
00059 GLhandleARB vertexShaderHandle;
00060 GLhandleARB fragmentShaderHandle;
00061 vertexShaderHandle = loadShader(vertexshadername,GL_VERTEX_SHADER);
00062 fragmentShaderHandle = loadShader(fragmentshadername,GL_FRAGMENT_SHADER);
00063 shaderID.shaderID = glCreateProgramObjectARB();
00064 glAttachObjectARB(shaderID.shaderID,vertexShaderHandle);
00065 glAttachObjectARB(shaderID.shaderID,fragmentShaderHandle);
00066 glLinkProgramARB(shaderID.shaderID);
00067
00068 shaderID.Texture = glGetUniformLocationARB(shaderID.shaderID,"Texture");
00069 shaderID.lightPos = glGetUniformLocationARB(shaderID.shaderID,"lightPos");
00070 shaderID.weight = glGetUniformLocationARB(shaderID.shaderID,"weight");
00071 shaderID.exposure = glGetUniformLocationARB(shaderID.shaderID,"exposure");
00072 shaderID.density = glGetUniformLocationARB(shaderID.shaderID,"density");
00073 shaderID.decay = glGetUniformLocationARB(shaderID.shaderID, "decay");
00074
00075 return shaderID;
00076 }
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097 private:
00098 PostProcessingShaderObj gTransformQuadric;
00099 };