Canvas.todataurl() Is Not A Function - Error Node-webgl Wrapper
Currently I am trying to convert browser based client side volume rendering code to server side pure javascript based rendering. I use node-webgl at server side. My main goal is to
Solution 1:
.toDataURL() function is not defined in node-webGL wrapper. An alternative method is to make use of gl.readPixels (suggested by a member of this group).
Here is the way to use it.
var pixels = newUint8Array(canvas.width * canvas.height * 4);
gl.readPixels(0, 0, canvas.width, canvas.height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
after the execution of gl.readPixels, the buffer data is present in pixels. The data is of ImageData() format. With this data, further required process can be done.
Post a Comment for "Canvas.todataurl() Is Not A Function - Error Node-webgl Wrapper"