Firefox 36 preserveDrawingBuffer not supported

Dear all, I used to implement screenshots of the Cesium canvas including the html2canvas library. Set the preserveDrawingBuffer to true in the instatiation of the viewer, as suggested by Kevin Ring in oder posts.

Now I'm facing a big issue in using the same approach with the last release of firefox 36.01. Browsing on internet seems that this version doesn't support this webgl parameter anymore...

If I set the preserveDrawingBuffer to true the Cesium viewer start with a blank canvas without any error on console, but if I resize the browser window everything appear correctly.

If I set the parameter to false everythin is visible immediately but I can't use the library to take the screenshot of the canvas.

Another strange behaviour is that the same version of FF on mac works well...

All other browsers seem to have no problem on this context.

Any workaround to solve this issue?

Thanks for any suggestions!
Have nice weekend and best regard,

Michele

While I’m not sure what the problem is in Firefox, but setting preserveDrawingBuffer isn’t needed to take a snapshot anyway, you just need render immediately before calling canvaas.toDataURL. For example, paste the below code at the bottom of any Sandcastle example and it will snap a picture and open a new window when you click the button (works in Chrome and Firefox, I.E doesn’t render data URIs directly, but taking a screenshot still works.)

Sandcastle.addToolbarButton(“Snap”, function() {

viewer.render();

window.open(viewer.canvas.toDataURL(“image/png”));

});

Dear Matthew,

thanks a lot for your suggestion, it works and without importing the external library the code is definitely cleaner!

I had tried your method but the the cesium.render() was called in another function not directly on the button event listener and this caused the crash of Cesium.

Anyway, the problem is solved. Thanks a lot!
Michele