Kinda simple question I think, but have searched in many OpenGL forums and haven't found answer yet :(
I have shader for multitexture which works well, if all surfaces in scene uses 2 different textures to mix. But if some surfaces uses only 1 texture then those surfaces are black. How GLSL know if texture is binded or unbinded?
Function to bind one texture.
GLvoid Texture::Bind(GLuint ID) { glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, 0); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, ID);}
Shader:
uniform sampler2D Tex0;uniform sampler2D Tex1;...Texture0 = texture2D(Tex0, gl_TexCoord[0].st);// Surface is black because Texture1 is (0,0,0,0) ?!Texture1 = texture2D(Tex1, gl_TexCoord[0].st);Texture = Texture0 * Texture1;...gl_FragColor = Color * Texture;
Any good suggestions will be rated highly.
Thanks in advance!