Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all articles
Browse latest Browse all 2751

Blending mode changes in v4?

$
0
0

Hi,
I’m porting some code from v.3 to v.4.

Got some scribbling environment, where I have a sheet that can be scribbled over, but it should not be allowed to scribble outside it.
For that purpose, I have a png picture of a blank sheet, but with some transparency around the (uneven) edges (would post a screen if it were possible :frowning:) .

Structure:
RenderTexture, of the size of the sheet pic, rendering:

  • Sprite with the sheet pic + blend func src=ONE, dst=ZERO
  • Draw Node with blend fun src=DST_ALPHA, dst=ONE_MINUS_SRC_ALPHA

It worked in v.3 - the scribbles only showed up on the sheet and disappeared around the edges where the png is transparent. It doesn’t work in v.4 - the scribbles are visible all over the square png area, regardless of the png’s alpha value.

In fact, any changes I make to DrawNode’s blending function don’t seem to have any effect. Even if I set src to ZERO, scribbles still show up.

What’s changed? Or do I misunderstand something crucial about blending (not an expert on OpenGL)? :frowning:

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2751

Trending Articles