I want to some offscreen rendering but come across a very annoying problem in linux,
even when I use a vtkWindowToImageFilter as the destination of the render and call
Render() on the render window, it opens the window but only on linux, Windows is behaving
just fine.
At this point I would only expect the RendererSource to be updated and no window
to popup but in Linux(Ubuntu) it does. I’ve seen solutions on the web bout using Mesa
or overriding the class and remove the call that pops up the window.
You should be able to set up off-screen rendering without a render window in Linux, too, it is just a bit more finicky. Details have been discussed in the VTK forum and mailing list before, but just to give you some hints: there are CMake build flags that control off-screen rendering, order of operations matter (e.g., when you set render window flags and when you initialize the window), and it may make a difference which OpenGL library you use.
Hi @lassoan, can you tell more about the cmake flags? Using VTK 9 with vtkWindowToImageFilter with a multi-layer Renderers in the RenderWindow set by QOpenGLNativeWidget I only can draw the first renderer added.
Off-screen rendering usually works if you just enable it at runtime. However, you may need to adjust cmake variables at build time if you want your rendering to work without an empty window popping up or if you work on a headless node (no display is connected).