hello,
I try to mix two textures (grass and soil for example) but would setup the mix factor with a third texture that is a gray level texture…
these are the grass textures and soil texture:
I would mix the two textures above, using the color of this texture in order to setup the mix factor between them:
and I would obtain this:
But, I don’t how to do that with openg…
This is the code which I try to mix the textures but it doesn’t work…because I obtain the product of textures and 2 and not the product of textures 0 and 1 with texture 2 as mix factor…
In this code: nom[0] is soil texture
nom[1] is grass texture
nom[2] is level gray texture
glActiveTextureARB( GL_TEXTURE0_ARB );
glEnable( GL_TEXTURE_2D );
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
glBindTexture(GL_TEXTURE_2D,nom[0]);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
glActiveTextureARB( GL_TEXTURE1_ARB );
glEnable( GL_TEXTURE_2D );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS );
glBindTexture(GL_TEXTURE_2D,nom[1]);
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE );
glBindTexture(GL_TEXTURE_2D,nom[2]);
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_TEXTURE );
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE );
glTexEnvi( GL_TEXTURE_ENV,GL_COMBINE_ALPHA_ARB,GL_MODULATE );
thank you very much.