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

Text elements do not render correct background colors #57

Closed
akinsho opened this issue Nov 18, 2018 · 3 comments
Closed

Text elements do not render correct background colors #57

akinsho opened this issue Nov 18, 2018 · 3 comments

Comments

@akinsho
Copy link
Member

akinsho commented Nov 18, 2018

revery-text-bug

Setting a background for text elements does not set the color in the actual character's cell to match the overall background color leading to a patchy appearance, not entirely sure how to go about looking into this @bryphe, as the meat of how revery works aka shaders etc. is very new to me but could have a look if you point in me the right direction

@bryphe
Copy link
Member

bryphe commented Nov 19, 2018

Nice catch @Akin909. Definitely a bug with how we render text.

The shader where we color / render the text is here:
https://github.com/bryphe/revery/blob/c20634b72ab39dea1372aaef7d0b519452773df2/src/UI/FontShader.re#L31

The 'texture' we use to read the font has only a single channel (t.a is a float value from 0.0 -> 1.0). In theory - this code should work OK to make the text transparent (since it's setting the alpha value to 0), but we don't set the appropriate blend modes (which tell the GPU how to combine pixels that are already drawn with pixels that you are sending).

Some useful references I found for WebGL / Shaders:

@bryphe
Copy link
Member

bryphe commented Nov 20, 2018

@Akin909 - hope you don't mind - I took a go at this w/ #60.

@bryphe bryphe closed this as completed in 71d8a06 Nov 20, 2018
@bryphe
Copy link
Member

bryphe commented Nov 20, 2018

This should be fixed now, @Akin909 ! Let me know if it's not for you 👍

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