Go to this website.
Open up the console and write:
`
var canvas = $("#mandelbox-canvas")[0];
var imgData = canvas.toDataURL("image/png").split(',')[1];
console.log(imgData);
Why is the image blank? How can I fix this?
Things I have already tried:
I have tried the solution to this question. I.E. This code:
var canvas = $("#mandelbox-canvas")[0];
canvas.getContext('webgl',{preserveDrawingBuffer:true});
var imgData = canvas.toDataURL("image/png").split(',')[1];
console.log(imgData)
however the image is still blank. The image does not contain the image displayed on the canvas.
So after much trawling through StackOverflow I found the function drawScene()
which (somehow?) force toDataURL()
to return the image data as required:
var canvas = $("#mandelbox-canvas")[0];
drawScene()
var imgData = canvas.toDataURL("image/png").split(',')[1];
console.log(imgData)