Skip to content

Label alpha blending bug on Mac target #8378

@minggo

Description

@minggo

Note

This issue is migrated from here. It was created at 2014/03/21 17:42:19 +0000

Description

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.

Comments

  • Zombie added comment:
    Might be related to antialiasing. If I turn it off (for LabelBMFont) the artefacts are gone.
  • hagelslaginthevalleys added comment:
    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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions