Blend problem


#1

Hello to all.
I’m working on porting a painting application, from cocos2d-x 1.x to cocos2d-x 2.1.3.
I use a simple texture that simulates a brush to draw (A simple png file with alpha).
I use mode GL_POINT, and i draw on a CCRenderTexture:

/ / Set the BLEND
ccGLBlendFunc (m_sBlendFunc.src, m_sBlendFunc.dst);
ccGLBindTexture2D (TextureBrush-> getName ());

/ / Design in the render buffer
glDrawArrays (GL_POINTS, 0, vertexCount);

In order to delete the design, the user can choose the eraser. The rubber is implemented using the same texture but by changing the blend:

   if (enableRubber) {
     ccBlendFunc blend = {GL_ZERO, GL_ONE_MINUS_SRC_ALPHA};
     this-> setBlendFunc (blend);
   }

This type of blend works perfectly on the simulator, but not on ios devices .
On actual devices simply has no effect, does not draw.
How is this possible?
The same type of blend works perfectly with cocos2d-x 1.x, with opengles 1.0.
Thank you!


#2

Same problem also for me

Paint with ccGLBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)

Erase with ccGLBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA)

But erese doesn’t work on all device, works well on simulator.

If I use (GL_ZERO, GL_ZERO) to erase, it works, but with a flat square eraser (no alpha)

someone could help me.

thanks
Don