Projects > cpp > Issues > Bug #4504

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

Label alpha blending bug on Mac target

Bug #4504 [Closed]
Zombie 2014-03-21 17:42 . Updated about 2 years ago

Labels on Mac do show a alpha blending bug.

I created LabelTTF, LabelBMFont, and Label and set their color to WHITE.

They show small black borders around their outline.
Expected behaviour would be a complete white screen.

It can be fixed by setting premultiplied alpha for the label textures to 'true'. However even then their is still a very slight coloured outline.

Screen Shot 2014-03-21 at 18.40.26.png (95.5 kB) Zombie, 2014-03-21 17:42

Screen Shot 2014-06-20 at 4.58.58 PM.png (313.8 kB) hagelslaginthevalley, 2014-06-20 16:03

Zombie 2014-03-21 18:08

Might be related to antialiasing. If I turn it off (for LabelBMFont) the artefacts are gone.

hagelslaginthevalley 2014-06-20 16:03

This artifact occurs because the texture that the font is being rendered to is prefilled with Color4B(0, 0, 0, 0).

If you have an outline color of Color4b(255, 255, 255, 255) then the colors around the edge are being blended between 255 (white) and 0 (black).

The solution is for the texture to be prefilled with the setTextColor but with an opacity of 0. Or if an outline is present for it to be prefilled with the enableOutline color but with an opacity of 0.

This is a bug and still occurs in 3.1.1 using the cocos2d::Label class.

In the attached screen shot you can see a white outline of the font over a background asset that is also white. The black outline occurs because the blending of the outline of the text is being applied to the texture the font was rendered to (internally within the Label class) that is prefilled with black transparent pixels.

walzer@cocos2d-x.org 2014-10-08 02:59

Redmine issue system is closed, we are using github issue system instead.

This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8378

Atom PDF

Status:Closed
Start date:2014-03-21
Priority:Low
Due date:
Assignee:-
% Done:

0%

Category:mac
Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.