Multiple threads, each with a self-contained VTK pipeline

I am trying to write a program where several threads are running, each with their own self-contained vtkRenderWindow, vtkRenderer, pipeline, etc. If I don’t mix any VTK objects between threads, is this possible and/or safe?

VTK/FAQ - KitwarePublic seems to indicate this is not.

Also, note that most of the OpenGL libraries are not thread-safe. Therefore, if you are rendering to multiple render windows from different threads, you are likely to get in trouble, even if you have mutex locks around the render calls.

Is this still accurate? If so, in which way could I achieve the closest approximation of this?

I’ve gone ahead with trying this out, and the information appears to be out of date. Everything works so far, except for the resizing/repositioning of multiple windows, simultaneously (on Windows, at least). I’ve opened a patch to fix that, which will hopefully be merged soon: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7313

1 Like