How to convert render from three.js to .png file? -
how convert render .png image?
i've been looking around awhile nothing has worked.
here function use , a fiddle shows working.
function takescreenshot() { // screenshots work webgl renderer, preservedrawingbuffer should set true. // open in new window var w = window.open('', ''); w.document.title = "screenshot"; //w.document.body.style.backgroundcolor = "red"; var img = new image(); img.src = renderer.domelement.todataurl(); w.document.body.appendchild(img); // download file this. //var = document.createelement('a'); //a.href = renderer.domelement.todataurl().replace("image/png", "image/octet-stream"); //a.download = 'canvas.png' //a.click(); }
Comments
Post a Comment