set the texture for by glUniform1i
I have a question about how to set the texture by glUniform1i
. I have seen code like below.
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture0);
glUniform1i(_textureUniform, 0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texture1);
glUniform1i(_textureUniform, 1);
Does it mean, if I use the number i
in the glUniform1i
, then I have to use glActiveTexture(GL_TEXTURE **i** )
?
Yes, you are correct. The uniform value for a sampler refers to the texture unit, not the texture id.