Skip to content

Commit

Permalink
Update glow_integration.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jun 16, 2024
1 parent 97ffc6d commit 933cf51
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions crates/eframe/src/native/glow_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,18 @@ impl GlowWinitRunning {
frame_timer.resume();
}

let Some(current_gl_context) = current_gl_context.as_ref() else {
return EventResult::Wait;
};

if !gl_surface.is_current(current_gl_context) {
log::error!(
"egui::run_ui_and_pant: viewport {:?} ({:?}) was not created on main thread.",
viewport.ids.this,
viewport.builder.title
);
}

let screen_size_in_pixels: [u32; 2] = window.inner_size().into();
let clear_color = app.clear_color(&integration.egui_ctx.style().visuals);

Expand Down Expand Up @@ -756,9 +768,9 @@ impl GlowWinitRunning {
frame_timer.pause();
crate::profile_scope!("swap_buffers");
if let Err(err) = gl_surface.swap_buffers(
current_gl_context
.as_ref()
.expect("failed to get current context to swap buffers"),
current_gl_context,
// .as_ref()
// .expect("failed to get current context to swap buffers"),
) {
log::error!("swap_buffers failed: {err}");
}
Expand Down

0 comments on commit 933cf51

Please sign in to comment.