2016-11-06 4 views

답변

1

여기는 내가 사용하는 기능이고 작동하는 것으로 보이는 a fiddle입니다.

function takeScreenshot() { 
    // For screenshots to work with WebGL renderer, preserveDrawingBuffer should be set to true. 
    // open in new window like this 
    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 like this. 
    //var a = document.createElement('a'); 
    //a.href = renderer.domElement.toDataURL().replace("image/png", "image/octet-stream"); 
    //a.download = 'canvas.png' 
    //a.click(); 
} 
관련 문제