Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Blending problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 ak09   Members   -  Reputation: 131

Like
0Likes
Like

Posted 04 May 2013 - 06:09 PM

 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);
 

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);
...
 

err.PNG

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

 



Sponsor:

#2 irreversible   Crossbones+   -  Reputation: 1376

Like
1Likes
Like

Posted 05 May 2013 - 04:01 AM

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?



#3 ak09   Members   -  Reputation: 131

Like
0Likes
Like

Posted 05 May 2013 - 01:31 PM

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?



#4 irreversible   Crossbones+   -  Reputation: 1376

Like
0Likes
Like

Posted 07 May 2013 - 10:32 AM

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? :)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS