Hi,
could someone please explain to me how GL_MODULATE blends two textures?
For example:
// Multi-texturing:
// - Texture1
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TextureID1);
//
// - Texture2
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TextureID2);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
What will be the result?
Text1 + Text2?
Text1 * Text2?
If I had to pass through a CG fragment shader, I would write a procedure such as:
float4 main(float2 text1Coords : TEXCOORD0,
float2 text2Coords: TEXCOORD1,
uniform sampler2D texture1 : TEXUNIT0,
uniform sampler2D texture2 : TEXUNIT1): COLOR
float3 color1 = tex2D(texture1, text1Coords).rgb;
float3 color2 = tex2D(texture2, text2Coords).rgb;
return float4(color1+color2, 1); // Which one?
return float4(color1*color2, 1);
return float4(color1?color2, 1);
What should I return? Am I on the right track?
Thanks!