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

Don't unpack premultiply alpha for text data textures #6236

Merged
merged 2 commits into from Jul 1, 2023

Conversation

davepagurek
Copy link
Contributor

Resolves #6235

Text rendering was breaking because we premultiply alpha on all images that get loaded in to WebGL now. This is good for image rendering, but the text shader passes in data textures where the alpha channel doesn't actually represent the opacity of a color, it just represents numbers. We don't want to mess up the numbers, so I turn it off now in the text shader.

Changes:

  • Temporarily turns off UNPACK_PREMULTIPLIED_ALPHA when passing data images into the text shader

Screenshots of the change:
image

PR Checklist

  • npm run lint passes
  • [Inline documentation] is included / updated
  • [Unit tests] are included / updated

@@ -757,6 +759,7 @@ p5.RendererGL.prototype._renderText = function(p, line, x, y, maxY) {

this._doStroke = doStroke;
this.drawMode = drawMode;
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is gl defined in this scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha you can tell I moved this around -- but it looks like it's already defined on line 684 which is why it didn't break, so I can take out the one I added in this PR!

@Qianqianye Qianqianye requested a review from aferriss June 30, 2023 22:33
@aferriss
Copy link
Contributor

aferriss commented Jul 1, 2023

LGTM!

@aferriss aferriss merged commit 29ff095 into processing:main Jul 1, 2023
5 checks passed
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

Successfully merging this pull request may close these issues.

WebGL text not rendering correctly
2 participants