diff options
author | 2021-08-02 10:14:33 +1000 | |
---|---|---|
committer | 2021-08-03 06:36:51 +1000 | |
commit | 77a65067108bea351d744e03fd20821b758cd214 (patch) | |
tree | 1214e49654cb41642fb946d9fbc2fa8f586aca49 /glutin | |
parent | a08e4ebccbb72f9cf6fca01047e0b46a482ca9ea (diff) | |
download | iced-77a65067108bea351d744e03fd20821b758cd214.tar.gz iced-77a65067108bea351d744e03fd20821b758cd214.tar.bz2 iced-77a65067108bea351d744e03fd20821b758cd214.zip |
Fix glow and multiple windows usage
The context might not be current at redraw
Diffstat (limited to 'glutin')
-rw-r--r-- | glutin/src/application.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/glutin/src/application.rs b/glutin/src/application.rs index 991c8705..7ed6315d 100644 --- a/glutin/src/application.rs +++ b/glutin/src/application.rs @@ -146,7 +146,7 @@ async fn run_instance<A, E, C>( mut runtime: Runtime<E, Proxy<A::Message>, A::Message>, mut debug: Debug, mut receiver: mpsc::UnboundedReceiver<glutin::event::Event<'_, A::Message>>, - context: glutin::ContextWrapper<glutin::PossiblyCurrent, Window>, + mut context: glutin::ContextWrapper<glutin::PossiblyCurrent, Window>, exit_on_close_request: bool, ) where A: Application + 'static, @@ -255,6 +255,16 @@ async fn run_instance<A, E, C>( } event::Event::RedrawRequested(_) => { debug.render_started(); + + #[allow(unsafe_code)] + unsafe { + if !context.is_current() { + context = context + .make_current() + .expect("Make OpenGL context current"); + } + } + let current_viewport_version = state.viewport_version(); if viewport_version != current_viewport_version { |