- I have a list of objects; Home
- Each object has different amounts of texture; Home
- When I make glBindTexture of 2 textures (diffuse and specular) for an object, it may happen that the next object can only have 1 (diffuse) texture; Home
- It happens that the second texture of the first object ends up being sent to the next object to be rendered, because the second texture is still linked.
Question: Would you like to know how to proceed in these cases and try to unlink all previous textures is appropriate? If yes, how? Because I've tried using the glDisable function (GL_TEXTURE_2D); it's just that it's not untying.
Asyoucanseethespeculartextureofthewallhasstoppedattheglassesthatonlyhasthediffusetexture.(Andno,bycoincidenceitlooksliketheglassesarereflectingthescenario,butthat'snotit)
for(Mesh&obj:openglDraw::objs){
...if(obj.textureDiffuse.size()!=0){unsignedinti=0;for(unsignedint&j:obj.textureDiffuse){openglUtils::setTexture(programme,i,j);openglUtils::setInt(programme,"material.diffmap", i);
i++;
}
for (unsigned int &j : obj.textureSpecular) {
openglUtils::setTexture(programme, i, j);
openglUtils::setInt(programme, "material.specmap", i);
i++;
}
...
glDisable(GL_TEXTURE_2D);
}
...