I’m trying to grab the bitmap data of the webGL canvas element.
I’ve tried many ways for 4 hours and gave up and am now asking for advice.
The closest I’ve gotten is using something similar to
function convertCanvasToImage(canvas) {
var image = new Image();
image.src = canvas.toDataURL();
return image;
};
which returns 64x data, but is blank.
to which the netziens recommend setting the preserveDrawingBuffer to true.
Like so:
awayCanvas.getContext(“experimental-webgl”, {preserveDrawingBuffer: true});
However I don’t know if this actually does anything.
Nonetheless, I’m just trying to get a screen shot of the Away View on the webGL canvas, to duplicate into a separate image tag.