Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d: help understanding setblendfunc to blend sprites

New to OpenGL and cocos2d and struggling to understand the setBlendFunc on sprites. Where can I get an explanation of the constants used.

I am trying to allow a user to rub away a sprite and see what is below it. This would only be for a certain sprite on the page.

Any tips greatly appreciated.

like image 868
Samuel Goldenbaum Avatar asked Feb 03 '26 22:02

Samuel Goldenbaum


1 Answers

Try reading documentation on OpenGL ES 1_0 glBlendFunc

I believe what you are looking for is (ccBlendFunc){GL_ZERO, GL_ZERO} as it will clear both source and destination or try (ccBlendFunc){GL_ZERO, GL_ONE_MINUS_SRC_ALPHA} which will clear the source (the image with which you want to scratch the surface - circle or whatever make it to have alpha == 1 where you want it to clear and alpha == 0 (full transparency) outside the area) and will set the alpha of destination (background) to 0 as it will substract 1 from whatever was set there - most likely one as well.

like image 134
Tom Tu Avatar answered Feb 05 '26 12:02

Tom Tu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!