Constant opacity with glBlendFunc on iPhone
Posted
by Jeff Johnson
on Stack Overflow
See other posts from Stack Overflow
or by Jeff Johnson
Published on 2010-03-07T17:56:39Z
Indexed on
2010/03/07
23:53 UTC
Read the original article
Hit count: 816
What glBlendFunc should I use to ensure that the opacity of my drawing is always the same? When I use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and multiple images are drawn on top of each other, the result is more and more opaque until it's completely opaque after a certain number of imgaes.
The closest I have come is to use glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA) which maintains a constant opacity no matter how many images are on top of each other, although there is a slight variation in opacity if the images overlap each other.
Any other render states I should consider trying? Any other ideas? I am making a drawing app for my kid and I don't want the images (brush) they draw to cover up the background.
Heres the closest I've got:
I want to have it so that the overlap part of the circles is the same color and opacity as the center part of the circle.
I am using cocos2d iphone v. 0.99
© Stack Overflow or respective owner