1

Im using cocos2d to create a simple drawing app, I create a 32 bit texture in code in the shape of the brush i need (circle) with a simple hardness gradient (alpha = 1 in middle and alpha = 0 close to edge) The texture is obviously square so alpha is 0 outside the circle. The user touches the screen to draw and a the texture is repeated according to a separation constant.

i tried without alpha blending enabled and i get horrible result.

With (ccblendfunc){GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA} i get boundaries appearing between each instance of the texture. This effect does not happen if i manually create each point by tapping instead of dragging.

And with (ccblendfunc){GL_SRC_ALPHA,GL_ONE} i get good results but at the edges the colors are added together, blue and green = cyan, red and green = yellow and red and blue = purple

how can i simply create a blend mode that works like photoshop's standard????

bobjamin
  • 265
  • 1
  • 2
  • 11

0 Answers0