opensourceBIM / BIMsurfer-before2019

This is the repository of the v1 and v2 version of BIM Surfer. It is not maintained anymore. Find the most recent version on https://github.com/opensourceBIM/BIMsurfer
MIT License
432 stars 195 forks source link

Capture screenshot of canvas #142

Open Shadowing01 opened 8 years ago

Shadowing01 commented 8 years ago

Hello,

I would like to attend an issue in the BIMsurfer/BIMvie.ws project: In 3dview.html there is a button called "Screenshot". It is made invisible but there is code behind it that calls a plugin scenejs called "capture.js" located in (bimsurfer\lib\scenejs\plugins). I think this function should make an image from model shown in the canvas, however the resulting image is fully white.

The plugin origin: http://scenejs.org/examples/index.html#canvas_capture

I hope you can find some time to investigate, it would help me out alot.

Richard Bos

dlabz commented 8 years ago

Try this:

var toDataURL   = function(domElement, mimetype)
    {
        mimetype    = mimetype  || "image/png";
        var dataUrl = domElement.toDataURL(mimetype);
        return dataUrl;
    }
Shadowing01 commented 8 years ago

Thanks dlabz, unfortunately your suggestion has not solved my issue. I have got it to work in a test project with a canvas containing some simple drawing. The plugin uses the same code but for some reason it's not working with BIMsurfer.

dlabz commented 8 years ago

Check if 'preserveDrawingBuffer' is set to 'true'. http://www.javascripture.com/WebGLContextAttributes