Force flushing on vtkWebApplication rendering

I am using the RPC “viewport.image.push” combined with a manual camera update to query for an image of the updated rendering. It takes more than 1s in localhost configuration to get the image. I looked at the explanation and it is because the image is “stale” so I need to wait for another one.

In my case, where I just move the camera and calling the RPC manually, I would like to force the flushing to occur. It makes the process very fast and transparent on the client side. Is there a way to do it? If not, could we have a method like InvalidateCache but setting the Data to nullptr to force the flush?

Thanks for your help

Trigger an interactive render (reduced quality => jpeg compression) first and then switch back to full quality. This will allow you to get a pretty good image fast and the perfect looking one later.

That’s one way to see the problem but I do not really need to have an interactive rendering. It takes time not because of the downloading process but because the protocol is doing another call which is delayed of deltaStaleTimeBeforeRender (0.5s).

If I prevent the WebApplication to send a stale image using the Flush method, this second call is skipped and the delay is removed. So If I could manually call this Flush, it will solve the problem.

Then I would create your own protocol inheriting from that one and providing another implementation of the pushRender that will actually wait.

How would you wait? The vtkWebApplication does not provide such api, either to wait or to flush. Or maybe I did not understood what you are suggesting.

You need to do a busy wait until the image is properly encoded (not stale anymore).