Thanks. So when I do that, how do I access each individual texture from a GLSL fragment shader?
you will have two uniform sampler2Ds in your fragment program and you will access each with the stander texture2D function the only difference is that you will have two uniforms instead of one. You will send textures to your shader like so:
//Sample code used for normal mapping glActiveTexture(GL_TEXTURE0); glUniform1i(texture_location, 0); glBindTexture(GL_TEXTURE_2D, dTex); glActiveTexture(GL_TEXTURE1); glUniform1i(normal_texture_location, 1); glBindTexture(GL_TEXTURE_2D, dNorm); glActiveTexture(GL_TEXTURE2); glUniform1i(height_texture_loc, 2); glBindTexture(GL_TEXTURE_2D, dHeight);
and use them like so
//simple multiplicative blending example
varying vec2 texCoord;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
void main()
{
vec4 sample1 = texture2D(texture1, texCoord);
vec4 sample2 = texture2D(texture2, texCoord);
vec4 sample3 = texture2D(texture3, texCoord);
gl_FragColor = sample1 * sample2 * sample3;
}