diff options
author | 2021-08-03 15:12:59 +0700 | |
---|---|---|
committer | 2021-08-03 15:12:59 +0700 | |
commit | cdd2f247f8c22775a5035be03715775c96cd1037 (patch) | |
tree | 1214e49654cb41642fb946d9fbc2fa8f586aca49 | |
parent | a08e4ebccbb72f9cf6fca01047e0b46a482ca9ea (diff) | |
parent | 77a65067108bea351d744e03fd20821b758cd214 (diff) | |
download | iced-cdd2f247f8c22775a5035be03715775c96cd1037.tar.gz iced-cdd2f247f8c22775a5035be03715775c96cd1037.tar.bz2 iced-cdd2f247f8c22775a5035be03715775c96cd1037.zip |
Merge pull request #980 from yamadapc/fix-glow-context-multiple-windows
Fix glow and multiple windows usage
-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 { |