cocos2d-x OpenGL blending equation for Sprite

How can I set blending equation for Sprite? Here you can see that there are several modes:

  1. GL_FUNC_ADD
  2. GL_FUNC_SUBTRACT
  3. GL_FUNC_REVERSE_SUBTRACT
  4. GL_MIN
  5. GL_MAX

How can I set them for blending in cocos2d-x. I have found only how to set blending function.

It defaults to GL_FUNC_ADD. I don’t think the equation is part of the API so you will probably have to override draw or use a CustomCommand and call those GL methods yourself.

@stevetranby

Agree, but there is no callback for draw command for Sprite. Actually I want to implement this in new cocos2d-x : Shadow sprites It sets GL_FUNC_REVERSE_SUBTRACT, draws the sprite and resets back to default GL_FUNC_ADD

True, but you can subclass Sprite and then override the draw method to create a custom command with a draw callback like in DrawNode.