MarlonJD / babylonjs_viewer

Flutter 3D Model Viewer with BabylonJS Viewer
MIT License
27 stars 10 forks source link

Make screenshot of the scene #13

Open hellhorse123 opened 1 year ago

hellhorse123 commented 1 year ago

I'm trying to take a screenshot from BabylonJSViewer using the screenshot.dart library and on the iPhone simulator it takes a photo of only a white screen (on Android everything is fine):

 Screenshot(
                    controller: _screenshotController,
                    child: BabylonJSViewer(src: mannequinLink)),

. I also get errors:

 [VERBOSE-2:platform_view_layer.cc(19)] Trying to embed a platform view but the PrerollContext does not support embedding
[VERBOSE-2:platform_view_layer.cc(38)] Trying to embed a platform view but the PaintContext does not support embedding

although adding the necessary line to info.plst :

<key>io.flutter.embedded_views_preview</key>
    <true/>
MarlonJD commented 1 year ago

Can you get the model without the capturing screenshot?

hellhorse123 commented 1 year ago

yes, and I can also take a screenshot of other widgets besides the scene. But I can’t take a screenshot of the scene, so I’m trying to figure out which library is the problem. Due to the fact that I only get errors

 [VERBOSE-2:platform_view_layer.cc(19)] Trying to embed a platform view but the PrerollContext does not support embedding
[VERBOSE-2:platform_view_layer.cc(38)] Trying to embed a platform view but the PaintContext does not support embedding

when I try to take a screenshot of the scene - I thought that maybe the problem is in the library BabylonJSViewer

MarlonJD commented 1 year ago

Actually, there is a screenshot method in Babylon's viewer itself. I'll try in there to getting screenshot, but it can be hard to get this to the device