Checking if the rendering was successful

Hi, I’m trying to render a 3d volume. To catch error events I use ErrorObserver example.
After the pipeline setup, I do ResetCamera() and Render(), but the return of the Render() function doesn’t guarantee that no errors will come after that:

renderer->ResetCamera();
renderWindow->Render();
std::cout << “we don’t know if the rendering was successful, the ErrorObserver could be called even after this point”;

My question is, how do I know if the rendering was successful?

1 Like

Hello,

I think this was addressed before: How to catch errors in VTK

See if that helps.

regards,

PC

Hi @Paulo_Carvalho !

I think the problem here is the opposite: How to detect if no error happened. As @mykolav is saying, the observer will be called asynchronously when an error happened. But from the async call, its hard (or impossible) to know when no error happened. For example, we had an error from a large memory allocation that came seconds later after the rendering method completed!

So its hard to say at which point in time the rending is finished and all errors should be delivered. We can start a timer and wait, but what is a “good” waiting time? Seconds? Minutes?

This is the question here: Is there a signal saying something like “The rendering is finished, if there was no error yet you can stop waiting for one”?

All the best, Mario

I guess those links are not available anymore.

Well… if the callback wasn’t called, then there wasn’t any error… Like, if there is no smoke, there is no fire. Right?

I suggest you to google after the class names. It’s likely they have been moved elsewhere. It also helps the community if you report broken links in that topic.

Well… if the callback wasn’t called, then there wasn’t any error… Like, if there is no smoke, there is no fire. Right?

No, thats exactly the problem! The rendering may already be in error. We just can’t smell the smoke yet.

For what we want to do, we must know if a rendering succeeded or not. But since we only get a signal on error, we can never be sure how long to wait.

Cutting a long story short, and getting back to the original question: Is there a way to know when the rendering is complete?

You can try vtkRenderWindow::WaitForCompletion(). I never tried it myself, though. Never needed it.

1 Like