I׳m now not in front my computer to check it, but I did the second option before, and it hadn't worked well. It seems to me by debugging that several render() are invoked before the rendering is completed, especially when there is a big amount if tiles to be rendered. So, I assume that also calling render() by my code won't do the job, I will check it later.
I tried to check if the rendering completed by the object viewer.scene.globe._surface. There is an array of tiles to be rendered with a state property. I did for each and checked that all the states are done, but it wasn't enough. After some render() all the states were done, but it wasn't truely completed. In the screenshot I've got a lot black spaces.
I tried also to capture the screenshot in the complete callback of camera.flyTo(). But it hadn't worked too.
I want to know if there is a truely indicator to check the completion of rendering.
make sure you are constructing your CesiumWidget / Viewer with the following options:
options.contextOptions.webgl.preserveDrawingBuffer = true;
This ensures that the OpenGL framebuffer is not discarded after
rendering and is therefore accesible to the canvas (this option
may have performance implications).