Changeset 10143 in orxonox.OLD for trunk/src/lib/graphics
- Timestamp:
- Dec 23, 2006, 2:04:28 PM (18 years ago)
- Location:
- trunk/src/lib/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/shader.cc
r10142 r10143 52 52 } 53 53 } 54 54 55 void Shader::Uniform::setV(unsigned int count, int* vv) const 55 56 { … … 96 97 PRINTF(2)("Your system does not support shaders\n"); 97 98 this->load(vertexShaderFile, fragmentShaderFile); 98 99 99 } 100 100 -
trunk/src/lib/graphics/shader.h
r10118 r10143 22 22 { 23 23 public: 24 25 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 28 29 30 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 33 34 35 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; … … 53 53 54 54 bool load(const std::string& vertexShaderFile, const std::string& fragmentShaderFile = "") 55 55 { return this->data->load(vertexShaderFile, fragmentShaderFile); } 56 56 57 57 … … 71 71 static bool isSupported() { return checkShaderAbility(); }; 72 72 73 73 inline static bool isShaderActive() { return (Shader::storedShader != NULL) ? true : false; }; 74 74 inline static const Shader* getActiveShader() { return Shader::storedShader; }; 75 75 … … 78 78 79 79 private: 80 ShaderData::Pointer data;80 ShaderData::Pointer data; 81 81 82 82 static const Shader* storedShader; -
trunk/src/lib/graphics/shader_data.cc
r10114 r10143 65 65 return true; 66 66 } 67 67 68 68 return true; 69 69 } … … 74 74 ShaderData::~ShaderData () 75 75 { 76 if (shaderProgram == 0) 77 return; 78 79 76 80 if (this->shaderProgram == glGetHandleARB(GL_PROGRAM_OBJECT_ARB)) 77 81 glUseProgramObjectARB(0);
Note: See TracChangeset
for help on using the changeset viewer.