views:

38

answers:

1

opengl ver: opengl es 1.x platform: iphone

The blending equation:

(Rs Sr + Rd Dr, Gs Sg + Gd Dg, Bs Sb + Bd Db, As Sa + Ad Da)

How does it work? I don't understand if I set both src and des to GL_ONE, and I have src color red (255,0,0) and des color black (0,0,0), the result will be (0,0,0)

Can someone explain how the equation work, or maybe show some calculation.

Thanks

A: 

if you set src and dst to GL_ONE, you will not get black.

The result is (Rs + Rd, Gs + Gd, Bs + Bd) (as Sr = Sg = Sb = Dr = Dg = Db = 1)

Which in your case of (255,0.0) and (0,0,0) will give (255,0,0).

Bahbar
Ya, that is what I think the result will be. I am using cocos2d and the outcome is not what I expected. So there must be something wrong with my game logic
Leo