Specularmap support,

(fix bug in texture binding!)
This commit is contained in:
4VRDriver
2020-09-06 20:37:59 +02:00
parent bd2df7e928
commit 8b1fe545c1
7 changed files with 27 additions and 55 deletions

View File

@@ -44,7 +44,7 @@ Texture::~Texture() {
}
void Texture::bind(uint8_t textureUnit, ShaderProgram* shaderProgram, uint8_t textureTypeNum) {
std::string uniformName = "u_texture_";
std::string uniformName = "texture_";
switch(textureType) {
@@ -62,11 +62,10 @@ void Texture::bind(uint8_t textureUnit, ShaderProgram* shaderProgram, uint8_t te
break;
}
// Add material. as we store textures in a struct
uniformName = "material." + uniformName;
shaderProgram->setUniform(uniformName.c_str(), textureTypeNum);
// Add u_material as we store textures in a struct
uniformName = "u_material." + uniformName;
shaderProgram->setUniform(uniformName.c_str(), textureUnit);
glActiveTexture(GL_TEXTURE0 + textureUnit);
glBindTexture(GL_TEXTURE_2D, textureId);
}