Integrate VTK inside egui

Hi, I am trying to use VTK to create custom widgets for use with egui.rs. To do so I have tried combining the egui example for custom OpenGL widgets at egui/examples/custom_3d_glow/src/main.rs at main · emilk/egui · GitHub with the VTK external rendering example/test at https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/External/Testing/Cxx/TestGLUTRenderWindow.cxx. I have placed the proof-of-concept code I have so far at GitHub - Gerharddc/egui-vtk. Currently the example only works on Windows but adapting it for Linux should just require minor CMake adjustments.

So far I have managed to get something that compiles and runs but unfortunately the VTK widget is just black as shown below:

I am also hit with a ton of errors similar to:

2025-05-22 23:02:07.188 ( 20.377s) [6F24EB89BD0D50E2]vtkOpenGLRenderWindow.c:286 WARN| . . GL Message: id=1005 source=SOURCE_API(0x8246) type=ERROR(0x824c) severity=HIGH(0x9146) message=No detailed debug message due to a non-debug context

The are many of these for each render pass. And after checking with the debugger, it seems the log at vtkOpenGLRenderWindow.c:286 is the result of various different OpenGL calls so I suspect this is a general issue with the OpenGL integration.

Unfortunately I have no idea where to go from here as that is about all the information I have. I really expected this to work once it compiled + ran without crashing since the egui part should be making the OpenGL context active right before calling render on VTK and my impression is that with the external renderer, this is what VTK expects.

Any ideas?