Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label alpha blending bug on Mac target #8378

Closed
minggo opened this issue Sep 30, 2014 · 1 comment
Closed

Label alpha blending bug on Mac target #8378

minggo opened this issue Sep 30, 2014 · 1 comment
Assignees
Milestone

Comments

@minggo
Copy link
Contributor

minggo commented Sep 30, 2014

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.

@minggo minggo added this to the v3.3 milestone Oct 9, 2014
@WenhaiLin
Copy link
Contributor

@minggo BlendFunc of Label is right. Fixed opacity issue at #8588

@minggo minggo closed this as completed Oct 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants