HI
I’m kind a stuck here. I try to use simple transparency, should work fine, but it doesn’t.
I use the following code to do it:
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,GL_DECAL);
glBindTexture(GL_TEXTURE_2D, Text[0]);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,1.0f);
glVertex3f(0,0,PosZ);
glTexCoord2f(1.0f,1.0f);
glVertex3f(SizX ,0,PosZ);
glTexCoord2f(1.0f,0.0f);
glVertex3f(SizX,-SizY, PosZ);
glTexCoord2f(0.0f,0.0f);
glVertex3f(0, -SizY, PosZ); glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
So, the texture is in RGBA, and i want it transparent at the pixels/texels where the alpha is 0.
The problem i have and do totally not understand is, that the blending seems to work, but instead of that i see the background(or what i did draw at that position before i did the blending) shines through, the transparent part is filled with the last color used, that was set with glColor3f/4f(…) before.
actually the same happens, if i don’t use blending at all and just draw the texture with rgba to the screen.
Always it seems to be transperent, but not the ‘behind’ is showing. The last used/selected color fills the transparent parts.
I’ve no idea why this happens, and no idea how to fix anything about it. I don’t understand, all the tutrials i looked up, the don’t do anything different (or I’m just to stupid to see it, till now, at least)
Thanks for any help.
Flo