- Timestamp:
- Nov 22, 2006, 2:58:51 PM (18 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/shader.cc
r9869 r9942 35 35 void Shader::Uniform::setV(unsigned int count, float* vv) const 36 36 { 37 if (Shader::isSupported()) 37 38 switch (count) 38 39 { … … 53 54 void Shader::Uniform::setV(unsigned int count, int* vv) const 54 55 { 56 if (Shader::isSupported()) 55 57 switch (count) 56 58 { -
trunk/src/lib/graphics/shader.h
r9869 r9942 22 22 { 23 23 public: 24 Uniform(const Shader& shader, const std::string& location) {this->uniform = glGetUniformLocation(shader.getProgram(), location.c_str()) ; };25 Uniform(GLhandleARB shaderProgram, const std::string& location) {this->uniform = glGetUniformLocation(shaderProgram, location.c_str()) ; };24 Uniform(const Shader& shader, const std::string& location) { if (Shader::isSupported()) this->uniform = glGetUniformLocation(shader.getProgram(), location.c_str()) ; }; 25 Uniform(GLhandleARB shaderProgram, const std::string& location) { if (Shader::isSupported()) this->uniform = glGetUniformLocation(shaderProgram, location.c_str()) ; }; 26 26 27 void set(float v0) const { glUniform1f(this->uniform, v0); }28 void set(float v0, float v1) const { glUniform2f(this->uniform, v0, v1); }29 void set(float v0, float v1, float v2) const { glUniform3f(this->uniform, v0, v1, v2); }30 void set(float v0, float v1, float v2, float v3) const { glUniform4f(this->uniform, v0, v1, v2, v3); }27 void set(float v0) const { if (Shader::isSupported()) glUniform1f(this->uniform, v0); } 28 void set(float v0, float v1) const { if (Shader::isSupported()) glUniform2f(this->uniform, v0, v1); } 29 void set(float v0, float v1, float v2) const { if (Shader::isSupported()) glUniform3f(this->uniform, v0, v1, v2); } 30 void set(float v0, float v1, float v2, float v3) const { if (Shader::isSupported()) glUniform4f(this->uniform, v0, v1, v2, v3); } 31 31 32 void set(int v0) const { glUniform1i(this->uniform, v0); }33 void set(int v0, int v1) const { glUniform2i(this->uniform, v0, v1); }34 void set(int v0, int v1, int v2) const { glUniform3i(this->uniform, v0, v1, v2); }35 void set(int v0, int v1, int v2, int v3) const { glUniform4i(this->uniform, v0, v1, v2, v3); }32 void set(int v0) const { if (Shader::isSupported()) glUniform1i(this->uniform, v0); } 33 void set(int v0, int v1) const { if (Shader::isSupported()) glUniform2i(this->uniform, v0, v1); } 34 void set(int v0, int v1, int v2) const { if (Shader::isSupported()) glUniform3i(this->uniform, v0, v1, v2); } 35 void set(int v0, int v1, int v2, int v3) const {if (Shader::isSupported()) glUniform4i(this->uniform, v0, v1, v2, v3); } 36 36 37 37 void setV(unsigned int count, float* vv) const; … … 68 68 69 69 static bool checkShaderAbility(); 70 static bool isSupported() { return checkShaderAbility(); }; 70 71 71 72 inline static bool isShaderActive() { return (Shader::storedShader != NULL) ? true : false; };
Note: See TracChangeset
for help on using the changeset viewer.