问题描述
我需要制作网站截图.我尝试使用 html2canvas 和所有它的工作.但问题是我正在使用 THREE.WebGLRenderer 和 THREE.CSS3DRenderer(用于 webgl 中的 html)......所以当我制作屏幕截图时,它只从 WebGLRenderer 制作图像.CSS3DRenderer 被忽略,我不知道如何从两个渲染器制作屏幕截图.我正在使用这个解决方案:截取<body>的截图使用 html2canvas 并将 img 存储为 JS var
你可以使用这个代码 var Render=new THREE.WebGLRenderer({antialias: true,preserveDrawingBuffer: true});
>
和一个函数 onclick 打印:
$("#btn_print").click(function() {window.open( Render.domElement.toDataURL("image/png"), "Final");返回假;});
在线示例:http://develoteca.com/Panel/ 点击按钮打印
关键是:对象WebGLRenderer中的{antialias: true,preserveDrawingBuffer: true}
,问候.
I need to make screenshot of website. I tried using html2canvas and all and it's working. But problem is i'm using THREE.WebGLRenderer and THREE.CSS3DRenderer (for html in webgl)... So when I make screenshot it makes images only from WebGLRenderer. CSS3DRenderer is ignored and I don't know how to make screenshot image from both renderers. I'm using this solution:Take screenshot of <body> with html2canvas and store img as JS var
you can use this code var Render=new THREE.WebGLRenderer({antialias: true, preserveDrawingBuffer: true});
and a function onclick print:
$("#btn_print").click(function() {
window.open( Render.domElement.toDataURL("image/png"), "Final");
return false;
});
Example online:http://develoteca.com/Panel/ clic on button Print
The key is: {antialias: true, preserveDrawingBuffer: true} in object WebGLRenderer
,regards.
visit:http://develoteca.com
这篇关于Three.js 截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!