Jump to content
  • Advertisement
Sign in to follow this  
ak09

Blending problem

This topic is 1966 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

 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
Advertisement

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?

Share this post


Link to post
Share on other sites

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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!