#ifndef _SHADER_TYPES_H #define _SHADER_TYPES_H #include "glincl.h" namespace Shaders { class Uniform { public: Uniform(const Shader* shader, const std::string& location) { this->uniform = glGetUniformLocationARB(shader->getProgram(), location.c_str()) ; } Uniform(const Shader& shader, const std::string& location) { this->uniform = glGetUniformLocation(shader.getProgram(), location.c_str()) ; }; Uniform(GLhandleARB shaderProgram, const std::string& location) { this->uniform = glGetUniformLocation(shaderProgram, location.c_str()) ; }; void set(float v0) const { glUniform1f(this->uniform, v0); } void set(float v0, float v1) const { glUniform2f(this->uniform, v0, v1); } void set(float v0, float v1, float v2) const { glUniform3f(this->uniform, v0, v1, v2); } void set(float v0, float v1, float v2, float v3) const { glUniform4f(this->uniform, v0, v1, v2, v3); } void set(int v0) const { glUniform1i(this->uniform, v0); } void set(int v0, int v1) const { glUniform2i(this->uniform, v0, v1); } void set(int v0, int v1, int v2) const { glUniform3i(this->uniform, v0, v1, v2); } void set(int v0, int v1, int v2, int v3) const { glUniform4i(this->uniform, v0, v1, v2, v3); } void setV(unsigned int count, float* vv) const; void setV(unsigned int count, int* vv) const; private: GLint uniform; }; //! The Type of Shader. typedef enum { None = 0, //!< No Type at all Fragment = 1, //!< Fragment Shader. Vertex = 2, //!< Vertex Shader. Program = 4, //!< Compiled Shader Programm. } Type; } #endif /* _SHADER_TYPES_H */