back

by Rochus·6y ago·view on hn ↗
> but this doesn't make sense anywhere else either

But that's exactly what happens when you draw into an SDL raster window. Even when you have vector drawing operations on higher level, eventually pixels are modified; you can of course combine drawing operations and transport a patch of the screen to the host, but this still goes through an impressive machinery with a lot of copying.

> All of this combined makes the browser platform a quite frustrating platform to work on for anything that isn't very simple webpages

Well, eventually we're on the same page.

1 comments
SDL also does other weird things (or at least did), like rendering each 2D sprite in its own draw call.

The way to handle something like setting unique pixels is to keep a pixel buffer in memory on the WASM side, set the pixels in there, and then once per frame copy this pixel buffer into a WebGL texture and render this through a single WebGL draw call, or blit the pixel buffer to a 2D canvas if WebGL is not an option (also once per frame).

Unfortunately with WASM we don't have so many other ways to migrate a desktop GUI application at the moment. If I have to redesign the whole existing GUI application to run on WASM, the technology is not really attractive.