RustAudio / baseview

low-level window system interface for audio plugin UIs
Apache License 2.0
267 stars 57 forks source link

Allow taking ownership of the OpenGL context #120

Closed robbert-vdh closed 2 years ago

robbert-vdh commented 2 years ago

This is a follow up to #115. Having the window own the context seemed like a sensible approach to me since there's an on_frame() callback where you'd do your rendering, but some integrations like @BillyDM's iced_baseview do the rendering from a separate Send + Sync + 'static context, and you thus need to be able to move the OpenGL context into there. This change means that you'll need to move the GlContext into your window handle struct when first creating it by calling window.gl_context().take().

robbert-vdh commented 2 years ago

Since this allows the context to outlive the window this isn't a great solution. We'll need to find a different way to make iced_baseview work.