PDA

View Full Version : Texture Blending



Andrew Jameson
04-24-2003, 11:58 AM
Hi,
I'd like to be able to apply a texture to an object where the applied texture is a linear controlled blend of two textures ... a bit like a crossfade between the two textures.

I'd like to avoid using extension functions if possible and at the moment my textures are 24 bit ...

How's it done ?

Thanks

Andrew

Perspective
04-24-2003, 01:22 PM
multi-texturing can be done with the use of extension functions. if you dont want to use them, you need to use multi-pass rendering. ie. render the first texturered poly, then the second one in the same spot. you might want to consider applying a blend function to all of this.

*multi-texturing results (in general) in faster rendering

Andrew Jameson
04-25-2003, 12:56 AM
Hmm ... sorry but you seem to have only paraphrased my question. How do I actually do I multipass render such that the two textures can be merged with control over the ratio of the blend intensity ?

Does anyone have any good tips that can help make sense of the glBlendFunc parameters ... I find that the parameter names make no sense and it becomes a frustrating exercise of trial and error !

I've tried this as a basis for what I want ...
glBindTexture(GL_TEXTURE_2D, fTileCommon.HiddenTextureName);
glCallList(fTileCommon.GenList);
glColor4f(0, 0, 0, 0.5);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_ONE);
glDepthFunc(GL_EQUAL);
glBindTexture(GL_TEXTURE_2D, fTileShared.FaceTextureName);
glCallList(fTileCommon.GenList);
glDepthFunc(GL_LESS);
glDisable(GL_BLEND);
Thanks

Andrew

Mazy
04-25-2003, 01:12 AM
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);

(src*(1-alpha)) + (dest * alpha)

simple linear interpolation (or crossfade)