mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Create helper make_viewport_current
This commit is contained in:
@@ -878,6 +878,20 @@ mod glow_integration {
|
|||||||
fn get_proc_address(&self, addr: &std::ffi::CStr) -> *const std::ffi::c_void {
|
fn get_proc_address(&self, addr: &std::ffi::CStr) -> *const std::ffi::c_void {
|
||||||
self.gl_config.display().get_proc_address(addr)
|
self.gl_config.display().get_proc_address(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn make_viewport_current(&mut self, viewport: &Viewport) {
|
||||||
|
if let Some(gl_surface) = &viewport.gl_surface {
|
||||||
|
self.current_gl_context = Some(
|
||||||
|
self.current_gl_context
|
||||||
|
.take()
|
||||||
|
.unwrap()
|
||||||
|
.make_not_current()
|
||||||
|
.unwrap()
|
||||||
|
.make_current(gl_surface)
|
||||||
|
.unwrap(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GlowWinitApp {
|
struct GlowWinitApp {
|
||||||
@@ -1508,19 +1522,10 @@ mod glow_integration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let clipped_primitives = integration.egui_ctx.tessellate(shapes);
|
let clipped_primitives = integration.egui_ctx.tessellate(shapes);
|
||||||
{
|
|
||||||
let mut glutin = glutin.borrow_mut();
|
glutin
|
||||||
glutin.current_gl_context = Some(
|
.borrow_mut()
|
||||||
glutin
|
.make_viewport_current(&viewport.borrow());
|
||||||
.current_gl_context
|
|
||||||
.take()
|
|
||||||
.unwrap()
|
|
||||||
.make_not_current()
|
|
||||||
.unwrap()
|
|
||||||
.make_current(viewport.borrow().gl_surface.as_ref().unwrap())
|
|
||||||
.unwrap(),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
egui_glow::painter::clear(
|
egui_glow::painter::clear(
|
||||||
&gl,
|
&gl,
|
||||||
|
|||||||
Reference in New Issue
Block a user