Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
10.2k stars 1.17k forks source link

WebGL support #1356

Open piranna opened 5 years ago

piranna commented 5 years ago

Feature

Recently I got stumbled with the node-wpe-webgl repo, that implements a webgl compatible rendering context for Node.js. It's mostly a translation of the webgl APIs to the ones of EGL, but code is very simple and mostly copy-and-paste. I was thinking it would be possible to use it to provide support for the webgl rendering context in node-canvas, both directly by delegaing to it, or picking the code and integrating it directly into node-canvas code. First option would be very simple and straigforward, but has the problem that only would work with screen-based backends (in memory rendering would be possible by using an off-screen rendering surface, but would need a bit more work), while the second one would allow to have it integrated for all backends and also use the same rendering surface (at the cost of having Mesa as another dependency).

Downchuck commented 5 years ago

Some enumerations here (and in the upstream of the fork); https://github.com/Namamono1129/webgl-mock-threejs