-
• #2
I think it might be because
g.buffer
is a ArrayBuffer, not a Uint8Array.What about:
fs = require("fs"); (new Uint8Array(gr.buffer)).set(fs.readFile("myFile.bin"));
I think it might be because g.buffer
is a ArrayBuffer, not a Uint8Array.
What about:
fs = require("fs");
(new Uint8Array(gr.buffer)).set(fs.readFile("myFile.bin"));
I would like to load a binary image from sd directly to a graphicsbuffer.
The only way, it worked for me is this:
Using a temporary array and copy value by value in a loop looks strange to me.
And it takes a lot of CPU power to copy.
But all I tried to assign Uint8Array directly to graphics buffer, failed.
Failed in the way, that loaded image was not shown.
I'm pretty sure, there is a way to do better, but I don't find it.