Sign in to follow this  
ak09

Blending problem

Recommended Posts

ak09    131

 The first image shows one circle overlapping another. They were drawn in a texture, with fbo, and blended with

 

glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
 

[attachment=15533:certo.PNG]
The second one shows the same stuff, but one circle is on textureA, and the other one on textureB (both handled by a fbo). Each texture was drawn on the screen, calling

glBindTexture(GL_TEXTURE_2D, textureA);
...
glBindTexture(GL_TEXTURE_2D, textureB);
...
 

[attachment=15534:err.PNG]

My question is: why the blending differs? How can I fix it?

 

Share this post


Link to post
Share on other sites
ak09    131

For a better explanation on why alpha blending during runtime is wrong in the first place, check this out.

 

PS - what's in the alpha channel of the textures and the that of the active color when blending?

Sorry, what do you mean?

Share this post


Link to post
Share on other sites
irreversible    2860

Sorry, what do you mean?

 

Does the circle texture have an alpha channel? What's in it?

 

When blending, you'll usually want to use white color, eg:

 

glColor4f(1.f, 1.f, 1.f, fAlpha);

 

Or what is it that I failed to make sense about? :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this