2d text renders badly
See original GitHub issueMy canvas uses WEBGL and i am trying to draw regular debug text on top in 2D.
I am following this WEBGL method https://p5js.org/reference/#/p5/text
function preload() {
inconsolata = loadFont(
"https://cdnjs.cloudflare.com/ajax/libs/bwip-js/2.0.6/Inconsolata.otf"
);
}
function setup() {
pixelDensity(1); //lower is faster
var canvas = createCanvas(windowWidth, windowHeight, WEBGL);
textFont(inconsolata);
textSize(20);
textAlign(CENTER, CENTER);
Drawing text inside displayHUD()
makes it look very glitchy.
drawing text inside draw()
is glitchy too but in 3D space.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Fix poor font-rendering in Chrome on Windows (Example)
After going through a short wizard, this will fix some of the text rendering issues in Chrome. Enable "Disable accelerated 2D Canvas" in ......
Read more >Canvas text rendering (blurry) - javascript
It works by rendering the text at 3 times the normal width. ... result of webGl rendered content to a 2D canvas is...
Read more >How to Fix Google Chrome Font Rendering Issues
I've been having a heck of a time with terrible font rendering in Chrome. ... In my case, “GPU Accelerated Canvas 2D” was...
Read more >Font renders at low resolution to viewport when main ...
Font renders at low resolution to viewport when main window is scaled #65172 ... Use the 2d stretch mode (not viewport ) and...
Read more >r/opengl - Text Rendering Help
Hey everyone just have a quick question. Been working on a 2D game lately and made a system to easily change the UI...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just tried your example and also tried adding the
lights()
suggestion but it did not change anything 😦 Overall it’s not a big problem since i can just tell people to use a specific browser.One other thing to try. If you are using a lighting model in your draw loop, be sure to turn that off in the HUD, otherwise objects are shaded using that lighting model. This would affect how fonts are shaded too. For example, if the standard lighting model
lights()
is called in the draw loop, then callnoLights()
in the HUD code. I’ve updated the sketch so you can try it there first.