gpujs / gpu.js

GPU Accelerated JavaScript
https://gpu.rocks
MIT License
15.12k stars 655 forks source link

How to pass 2D image buffer/array as an input? #737

Open algj opened 2 years ago

algj commented 2 years ago

I'm using Node.js. I have a bitmap in a Buffer in such form [R,G,B,A,R,G,B,A,...].

I'm confused how to pass each pixel (R,G,B,A) instead of individual colors to gpu.js. Documentation explains how to do it with img/video browser elements, but not for raw image data.

Edit: I want to get output in the same order [R,G,B,A, ...], not in a canvas or something else, but as an array/buffer.