-
|
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? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
I still don't have things working with egui yet, but egui uses glow at the lower level (at least with its default "eframe" integration) and I now have integration directly with glow working on https://github.com/Gerharddc/egui-vtk/tree/glow. It turns out the warnings were caused by Another important factor to get VTK things visible was to call I also implemented a way to use |
Beta Was this translation helpful? Give feedback.
-
|
Ok so I finally got this working! In the end I had to resort to rendering VTK inside an offscreen FBO and piping its texture into an egui Image. I actually managed to get VTK drawing without that, but it refused to draw in the correct place for some reason. It drew with the correct size at least though. Anyway, this is probably a nicer approach anyway as it saves VTK from having to redraw for every frame. Now the last remaining challenge is to get mouse events forwarding... |
Beta Was this translation helpful? Give feedback.
-
|
Mouse integration is also working now! I have uploaded the final code to https://github.com/Gerharddc/vtk-egui-demo. |
Beta Was this translation helpful? Give feedback.




Mouse integration is also working now! I have uploaded the final code to https://github.com/Gerharddc/vtk-egui-demo.