Open satoshinm opened 7 years ago
https://stackoverflow.com/questions/25319040/display-text-with-webgl recounts the same bitmap font rendering technique Craft already uses, but there is an (interesting) comment:
There also is my http://taccGL.org library that can draw HTML text on a 2D canvas and then use it as textures on 3D objects drawn on a 3D/WebGL canvas.
their website seems glitchy when scrolling but http://taccgl.org/tutorial/index.html describes an intriguing approach, "Combining HTML5+CSS with WebGL™ ". Could WebGL be used with CSS transforms to embed HTML objects within a WebGL scene? But back to text rendering, the approach of rendering to a 2D canvas then using it as a texture for 3D objects with WebGL seems feasible. Could even render more complicated textures to the canvas (video?).
The sign text is currently generated in src/main.c, _gen_sign_buffer
and gen_sign_buffer
This may also allow for sharper text, when the window is resized the fixed-size bitmap font gets blurrier
@twetzel59 I think so (there's even an emscripten port of FreeType), as long as there is a suitably comprehensive font available, maybe https://www.google.com/get/noto/.
Craft includes its own font.png and sign.png, and only supports characters from these fonts, plain 7-bit ASCII. But there's many more possible characters, https://www.spigotmc.org/threads/websandboxmc.232807/page-4#post-2444596 asks:
Investigate whether it is possible in the browser port to use the browser's built-in text rendering APIs, for full Unicode compatibility. Canvas API drawing text: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text