00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef SHADEROBJECT_HH
00028 #define SHADEROBJECT_HH
00029
00030 #include <GL/gl.h>
00031 #include <GL/glext.h>
00032
00033 #include "ShaderProgram.hh"
00034
00035 class ShaderObject
00036 {
00037 public: ShaderObject();
00038 public: virtual ~ShaderObject();
00039
00040
00041 public: void AddShaderProgram( ShaderProgram *program );
00042
00043
00044 public: bool Link();
00045
00046 public: char *GetLinkerLog();
00047
00048
00049 public: void Begin();
00050
00051 public: void End();
00052
00053
00054 public: void EnableShader(bool b);
00055
00056
00057 public: bool OGSLEnabled();
00058
00059 public: bool SendUniform1f(char *var, GLfloat v0);
00060 public: bool SendUniform2f(char *var, GLfloat v0, GLfloat v1);
00061 public: bool SendUniform3f(char *var, GLfloat v0, GLfloat v1, GLfloat v2);
00062 public: bool SendUniform4f(char *var, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
00063
00064 public: bool SendUniform1i(char *var, GLint v0);
00065 public: bool SendUniform2i(char *var, GLint v0, GLint v1);
00066 public: bool SendUniform3i(char *var, GLint v0, GLint v1, GLint v2);
00067 public: bool SendUniform4i(char *var, GLint v0, GLint v1, GLint v2, GLint v3);
00068
00069 public: bool SendUniform1fv(char *var, GLsizei count, GLfloat *value);
00070 public: bool SendUniform2fv(char *var, GLsizei count, GLfloat *value);
00071 public: bool SendUniform3fv(char *var, GLsizei count, GLfloat *value);
00072 public: bool SendUniform4fv(char *var, GLsizei count, GLfloat *value);
00073
00074 public: bool SendUniform1fi(char *var, GLsizei count, GLint *value);
00075 public: bool SendUniform2fi(char *var, GLsizei count, GLint *value);
00076 public: bool SendUniform3fi(char *var, GLsizei count, GLint *value);
00077 public: bool SendUniform4fi(char *var, GLsizei count, GLint *value);
00078
00079 public: bool SendUniformMatrix2fv(char *var, GLsizei count,
00080 GLboolean transpose, GLfloat *value);
00081 public: bool SendUniformMatrix3fv(char *var, GLsizei count,
00082 GLboolean transpose, GLfloat *value);
00083 public: bool SendUniformMatrix4fv(char *var, GLsizei count,
00084 GLboolean transpose, GLfloat *value);
00085
00086
00087 public: void GetUniformfv(char *name, GLfloat *values);
00088 public: void GetUniformiv(char *name, GLint *values);
00089
00090 public: bool IsLinked();
00091
00092 private: GLint GetUniformLocation(const GLcharARB *name);
00093
00094 private: GLhandleARB shaderObject;
00095 private: GLcharARB *linkerLog;
00096
00097 private: GLint isLinked;
00098 private: bool enabled;
00099
00100 private: int shaderProgramCount;
00101 private: int shaderProgramMaxCount;
00102 private: ShaderProgram **shaderPrograms;
00103
00104 };
00105
00106 #endif