I'm using this library Photo Sphere Viewer
to "navigate" through a 360 image. I would like to be able to take a 2d snapshot of the view pressing a button.
I read that is not possible to save an image with toDataUrl('image/png')
in webgl context after the render in three.js without using preserveDrawingBuffer
flag.
This is my small script:
$('#capture').on('click', function(e) {
e.preventDefault();
var element = document.getElementsByTagName('canvas')[0];
var img = element.toDataURL("image/png");
});
This will save a base:64 image. My question is:
Is there a workaround without hardcode the library (with preserveDrawingBuffer: true
).
I wouldn't change that, mainly because I read that will slower the perfomances.
Thanks in advance