html5 canvas - taking a 'snapshot' of babylonjs scene sometimes works, sometimes doesn't -


i trying take 'snapshot' of babylon3d scene ... in other words: trying clone babylon3d canvas when user presses button, , append new <canvas> <body> .. works, other times not.

however, if use simple canvas (ie. using fillrect), cloning/appending works expected.

i have set test on plunker demonstrate problem: plunker: press button on , on again see how sporadic behaves when there babylon scene. and note: can toggle between simple canvas , babylon canvas within _jquery(document).ready(...) handler.

thanks, shannon 

this because version 2.3.0 of babylonjs :

engine initialize webgl preservedrawingbuffer = false default.

you need initialize engine passing {preservedrawingbuffer: true} object third parameter.

forked plnkr

but unfortunately kill canvas' performances.

see more here.

i'm not specialist of babylonjs, , didn't find way make call scene.render method use flag method proposed @capse. there babylon.tools.createscreenshot(engine, camera, size) method, make downloadable png scene ; maybe you.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -