0

I am trying to use egui with a custom renderer I made. I am rendering to the screen, but it looks like this:

enter image description here

i.e. the widget occupies the entire screen. When I inspect the data I get from egui

        let output = self.ctx.run(raw_input, |ctx|
        {
            egui::CentralPanel::default().show(&ctx, |ui| {
                ui.label("Hello world!");
                if ui.button("Click me").clicked() {
                    // take some action here
                }
            });
        });

 let clipped_primitives = self.ctx.tessellate(output.shapes);
    for primitive in clipped_primitives
    {
        println!("{:?}", primitive.clip_rect);
        /* render */
    }

I get:

[[0.0 0.0] - [800.0 800.0]]
[[0.0 0.0] - [800.0 800.0]]
[[0.0 0.0] - [800.0 800.0]]
[[0.0 0.0] - [800.0 800.0]]
[[0.0 0.0] - [800.0 800.0]]
[[0.0 0.0] - [800.0 800.0]]
[[0.0 0.0] - [800.0 800.0]]

Why arent the primitives clipped?

Makogan
  • 8,208
  • 7
  • 44
  • 112

1 Answers1

0

The answer is to use a Window container instead of a CentralPanel

Makogan
  • 8,208
  • 7
  • 44
  • 112