VTK 8.2 + EGL offscreen rendering, nvidia driver 440.33.01

Hi there,

I am interested in EGL-accelerated offscreen rendering and have read https://blog.kitware.com/off-screen-rendering-through-the-native-platform-interface-egl/.

I have successfully built VTK 8.2.0 with using GCC 7 on a 1.1-glvnd-devel-centos7` container from docker hub. CMake flags include ‘’’-D VTK_RENDERING_BACKEND=“OpenGL2” -D VTK_OPENGL_HAS_EGL=True -D VTK_USE_X=False’’’.

in the container, nvidia-smi shows graphics devices as expected, and rw = vtk.vtkRenderWindow(), rw.GetNumberOfDevices() matches that. However, when further running rendering-related code (windowToImageFilter), I see the error pasted below. An explicit rw.SetDeviceIndex() does not change this behavior.

Any ideas (also on how to efficiently continue debugging)?

Thanks,

 Sophonet

: 0x400c20 : ??? [(???) ???:-1]
Generic Warning: In /build/VTK-8.2.0/Rendering/OpenGL2/vtkOpenGLState.cxx, line 617
Error glEnable/Disable1 OpenGL errors detected
0 : (1282) Invalid operation

with stack trace of
0x7f41aeb2459b : vtksys::SystemInformationImplementation::GetProgramStack(int, int) [(libvtksys-8.2.so.1) ???:-1]
0x7f41aeb1f6e6 : vtksys::SystemInformation::GetProgramStack(int, int) [(libvtksys-8.2.so.1) ???:-1]
0x7f41b90d0a38 : ??? [(???) ???:-1]
0x7f41b90d21b9 : vtkOpenGLState::SetEnumState(unsigned int, bool) [(libvtkRenderingOpenGL2-8.2.so.1) ???:-1]
0x7f41b90d3027 : vtkOpenGLState::vtkglDisable(unsigned int) [(libvtkRenderingOpenGL2-8.2.so.1) ???:-1]
0x7f41b90afcec : vtkOpenGLRenderWindow::ReadPixels(vtkRecti const&, int, int, int, void*, int) [(libvtkRenderingOpenGL2-8.2.so.1) ???:-1]
0x7f41b90af8b8 : vtkOpenGLRenderWindow::GetPixelData(int, int, int, int, int, int) [(libvtkRenderingOpenGL2-8.2.so.1) ???:-1]

I suggest first getting this to work directly, not inside a container. This way eliminate one possible source of problems.
Your cmake parameters look right.

Thanks for the hint. The container was not the problem and indeed, I found the problem, which was doing VTK rendering on the same render window from multiple threads, which should be avoided.

I have now implemented message passing etc. such that all VTK-related rendering code occurs in the same thread (which is not the main thread though), and I am seeing similar problems (“function is no/op” etc.)

Are there any special details to consider for EGL/multi-threading?

Found another problem, now everything works inside a single thread. This topic can be closed now I guess…