4 ms·
Text in WebGL is still really immature. I've done a bit of tinkering with a variety of modules for word-wrapping, etc. None of them are "fully featured" or 100
by mattdesl 12y ago
Text in WebGL is still really immature.
I've done a bit of tinkering with a variety of modules for word-wrapping, etc. None of them are "fully featured" or 100% stable but I have used them in a couple of production environments.
https://github.com/mattdesl/fontpath https://github.com/mattdesl/fontpath
The WebGL module on top of that:
https://github.com/mattdesl/gl-sprite-text https://github.com/mattdesl/gl-sprite-text
The main issue I have with most text libraries (like TxtJS) is that they assume 2D canvas, or trivial WebGL applications. The bulk of the text code really just deals with laying out rectangular glyphs; the rendering (whether geometry, bitmaps, SDF, etc) should be separate so the dev can choose the best technique for their app.
An example of SDF / fontpath in action:
http://mattdesl.github.io/xmas http://mattdesl.github.io/xmas