0

Rendering to bitmap (whether from screen or off-screen)

wotnot 5 years ago updated by WooAja 3 years ago 9

I am trying to generate a bitmap from a HelixViewport3D and have encountered a few problems.

The first problem is that I cannot find a way to render off-screen. There are a few references to this online and as far as I can see it does not have a built-in solution.

As a workaround (and not a great one) I have proceeded to render to the screen where the user can see it, with the intention of creating a bitmap from that rendered image. I now have the problem that an image exported from the content on screen (e.g. using Viewport3DHelper.SaveBitmap, or other methods) is blank if I call it immediately. I presume this is because Helix Toolkit is rendering asynchronously(??) That is how it seems to be behaving. If I plot first, and then grab the image separately by clicking a button, then it works, which suggests to me that it is a timing problem.

There is no built-in OnRendered event. Is there a way I can get notification when viewport rendering has finished? ...or (preferred) not need to have it on screen in the first place?