mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 15:20:05 -04:00
Simplify backends by adding fn paint_and_update_textures helper
This commit is contained in:
@@ -67,14 +67,10 @@ pub fn run(app: Box<dyn epi::App>, native_options: &epi::NativeOptions) -> ! {
|
||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||
}
|
||||
|
||||
let (needs_repaint, mut textures_delta, shapes) =
|
||||
let (needs_repaint, textures_delta, shapes) =
|
||||
integration.update(display.gl_window().window());
|
||||
let clipped_meshes = integration.egui_ctx.tessellate(shapes);
|
||||
|
||||
for (id, image_delta) in textures_delta.set {
|
||||
painter.set_texture(&display, id, &image_delta);
|
||||
}
|
||||
|
||||
// paint:
|
||||
{
|
||||
use glium::Surface as _;
|
||||
@@ -82,20 +78,17 @@ pub fn run(app: Box<dyn epi::App>, native_options: &epi::NativeOptions) -> ! {
|
||||
let color = integration.app.clear_color();
|
||||
target.clear_color(color[0], color[1], color[2], color[3]);
|
||||
|
||||
painter.paint_meshes(
|
||||
painter.paint_and_update_textures(
|
||||
&display,
|
||||
&mut target,
|
||||
integration.egui_ctx.pixels_per_point(),
|
||||
clipped_meshes,
|
||||
&textures_delta,
|
||||
);
|
||||
|
||||
target.finish().unwrap();
|
||||
}
|
||||
|
||||
for id in textures_delta.free.drain(..) {
|
||||
painter.free_texture(id);
|
||||
}
|
||||
|
||||
{
|
||||
*control_flow = if integration.should_quit() {
|
||||
glutin::event_loop::ControlFlow::Exit
|
||||
|
||||
Reference in New Issue
Block a user