Hello all,
I am trying to blend 2 textures (applied to the same plane), both of which contain transparent areas.
The way I do it now is with two passes:
if(pass==0)
{
glBindTexture(GL_TEXTURE_2D, openGLName[0]);
glDisable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_REPLACE );
}
else
{
glBindTexture(GL_TEXTURE_2D, openGLNam [1]);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_DST_ALPHA,GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_NOTEQUAL,0);
I first apply the first texture and on top of it I blend the second. What seems to happen though is that the second texture covers and hides the transparent regions of the first one, something that shouldn’t happen with a (GL_DST_ALPHA,GL_ZERO) blending function.
Am I right, or if not what am I doing wrong??
Thanks a lot for any help!!
Kostas.