Why does calling toDataURL() on a canvas return a solid black image in some cases?
E.g. try this test case:
Open this URL in chrome: https://www.shadertoy.com/embed/Ms23DR
And then type in the js console:
window.open(document.getElementById("demogl").toDataURL("image/png"));
It shows a black image, why?
If you go to the non-embedded page and enter the same javascript, you get the desired image!
What causes the image to be black in the first case?
The reason why I'm asking is because I encountered this problem in my current project where I need to have a way to get the image from the canvas in a way that works in all modern browsers. I thought this way would work.
So I'd appreciate if you could tell me what causes the image to be black in the above test case.
Thanks!