From 77a65067108bea351d744e03fd20821b758cd214 Mon Sep 17 00:00:00 2001 From: yamadapc Date: Mon, 2 Aug 2021 10:14:33 +1000 Subject: Fix glow and multiple windows usage The context might not be current at redraw --- glutin/src/application.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'glutin') 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( mut runtime: Runtime, A::Message>, mut debug: Debug, mut receiver: mpsc::UnboundedReceiver>, - context: glutin::ContextWrapper, + mut context: glutin::ContextWrapper, exit_on_close_request: bool, ) where A: Application + 'static, @@ -255,6 +255,16 @@ async fn run_instance( } 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 { -- cgit