xeolabs / xeogl

A WebGL-based 3D engine for technical visualization. Not actively maintained.
http://xeogl.org
Other
1.14k stars 264 forks source link

3d snapshot is not working because of this.contextAttr.preserveDrawingBuffer=false #161

Closed emiyalee1005 closed 7 years ago

emiyalee1005 commented 7 years ago
Description of the problem

i can not snapshot the canvas by either using canvas.todataurl or stock viewer.getsnapshot() /bimsurfer also/ api,because preserveDrawingBuffer of webgl-context is set to false

xeogl version
Browser
OS
Hardware Requirements
xeolabs commented 7 years ago

Yes this is a tricky one because the zSpace display used by these demos only works with preserveDrawingBuffer set false.

Solution would be:

When relying on the default Scene provided by xeogl, then we would be able to configure what context attributes that xeogl will set on the default Scene's canvas, ie.

xeogl.defaultContextAttr.preserveDrawingBuffer = true;

// Creates default Scene at this point, with default context attributes as defined above
var myEntity = new xeogl.Entity({...}); 

and when creating your own scene, make it so that that your `preserveDrawingBuffer can override xeogl's:

var myScene = new xeogl.Scene({
    contextAttr: {
        preserveDrawingBuffer: true
   }
});

I'll do this one after the touch events.

xeolabs commented 7 years ago

Just fixed this in master. xeogl now supports two snapshot modes - see these examples: