PDA

View Full Version : Transparency problem



Balta66
06-13-2015, 05:37 AM
Hi

I have 2 textured planes (tga texture with alpha) in the same position and I can only see one plane it's the last one I render

I have activated blending like this :


glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


How do I solve this ?

Thanks a lot :)

Dark Photon
06-13-2015, 06:47 AM
glDisable( GL_DEPTH_TEST );


Most likely your first plane is setting depth, and your next plane is reading/testing against depth and being occlusion-tested away.

Balta66
06-13-2015, 07:05 AM
Ok thanks.

And How can I do to keep the native color of the first plane and the native color of the second ?
Because right now I get a mix of the colors and it is much more darker than the natives colors.

I set the blending like that:


glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
glBlendFunc(GL_DST_ALPHA, GL_SRC_COLOR);

Dark Photon
06-13-2015, 06:20 PM
And How can I do to keep the native color of the first plane and the native color of the second ?

What do you mean? You're blending. So presumably your goal is to get a mix of the two colors, right? Otherwise just disable blending.

You might describe in more detail the exact effect you want to get (all aspects of it) and why.