egui
egui copied to clipboard
Delete OpenGL objects on regular drop instead of explicit destroy in glow example
- [x] I have followed the instructions in the PR template.
This is equally a question and a change suggestion: Can I retain a clone of the Arc<glow::Context> and use it to deallocate OpenGL objects on drop, instead of having to explicitly listen to the on_exit event and pass that down from my top level App to all subcomponents that have allocated OpenGL objects?
I'm no OpenGL expert by any means. But from what I can find, OpenGL objects are tied to the contexts they were created under. So it would be surprising if the call to the destroy method had another context, than the one we got passed to us on initializiation? And if we always get the same context over and over, is there any reason why we can't just keep our own reference to it internally instead?
This is slightly related to #5285. But instead of dealing with the explicit destroy of the Painter in the library, it deals with examples, showing how egui users should deallocate their OpenGL objects.
Opening the PR as a draft, since I'm not 100% this solution is valid.