Hi, I would like to take a screenshot from the rendered canvas but when I tried to apply to toDataURL() to get the base64, the result is completely blank. In addition, I already took a look at the ParaView Glance's source code covering the screenshot feature but I am still very confused at the part img.addEventListener('load', () => {}. Here is my source code, hope to reiceve the answer from you. Thanks. @jourdain
function convertCanvasToImage(canvas) {
var image = new Image();
image.src = canvas.toDataURL("image/png");
return image;
}
base64 = convertCanvasToImage($('#3d canvas').get(0)).src;
It didn't work out, I tried console.log(openglRenderWindow.captureNextImage()); but just received a message Promise聽{<pending>} in browser's console. @jourdain
Great, that is what you are suppose to get...
The promise content will have the data you are looking for.
Then just trigger a render() to allow the promise to resolve.
Thanks for the assistance! I truly appreciate your patience 馃槂 @jourdain