I'm setting up two textures as follow:
GLKTextureInfo *texture = [GLKTextureLoader ...
glActiveTexture(GL_TEXTURE0);
glUniform1i(glGetUniformLocation(self.program, "uTextureMask"), 0);
glBindTexture(GL_TEXTURE_2D, texture.name);
texture = [GLKTextureLoader ...
glActiveTexture(GL_TEXTURE1);
glUniform1i(glGetUniformLocation(self.program, "uTextureLabel"), 1);
glBindTexture(GL_TEXTURE_2D, texture.name);
referred in the fragment shader:
uniform sampler2D uTextureMask;
uniform sampler2D uTextureLabel;
The problem is that only the last texture I bind is available in the shader. In the example above, only uTextureLabel works.
Any idea?
Thanks, DAN
UPDATE:
glGetUniformLocation returns 13 for uTextureMask and 14 for uTextureLabel.
In the shader I do:
highp vec4 label = texture2D(uTextureLabel, vTexel);
highp vec4 mask = texture2D(uTextureMask, vTexel);
highp vec3 surface;
surface = label.rgb;
// surface = mask.rgb; // <--- DOESN'T WORK
gl_FragColor = vec4(surface, 1.0);
glGetUniformLocation
calls? What you're doing in the code shown here looks fine to me. I noticed that you bind the same texture twice, but I figure you did that just to simplify the example. – Reto Koradi