4 ms·
Wait, how is this possible?? I tried to visualize a few tens of MB of text in the browser [1] on a canvas and it gets really choppy if I don't optimize it by no
by tomthe 2y ago
Wait, how is this possible?? I tried to visualize a few tens of MB of text in the browser [1] on a canvas and it gets really choppy if I don't optimize it by not showing stuff that can't be read.
Impressive that it can handle gigabytes of text!
[1]: https://tomthe.github.io/hackmap/ https://tomthe.github.io/hackmap/
- wongarsu 2y agoI'd wager by making the requirements simpler. Wideboard is rendering monospace, so every document is made up of of 8x16px cells, and you just have to decide which glyph to render in each. From a quick skim of the source code this is mostly precalulated. Basically each document is rendered as one rectange, where the shader converts the current position to the row/column of the character to be rendered. There is one texture that holds the length and starting offset of each line (using one pixel per line), and another texture that for each offset tells you which glyph to render (using one pixel per glyp). The third texture is the glyph map that holds the actual glpyhs (a simple 256x256 texture of all supported characters). The last texture is static, the other two are calculated once as the document is loaded, and there is a neat shader that uses all three textures to render the actual document view. Since the shader is sampled at fewer points if the rectangle takes up fewer pixels on your screen this works out well for zoomed out views.