Skip to content

Delete OpenGL objects on regular drop instead of explicit destroy in glow example #7046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

faern
Copy link

@faern faern commented May 12, 2025

  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant