Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 22, 2022
1 parent f522822 commit 00ff0a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions eframe/examples/custom_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl eframe::App for MyApp {
});

egui::ScrollArea::both().show(ui, |ui| {
egui::Frame::dark_canvas(ui.style()).show(ui, |ui| {
egui::Frame::canvas(ui.style()).show(ui, |ui| {
self.custom_painting(ui);
});
ui.label("Drag to rotate!");
Expand All @@ -75,7 +75,7 @@ impl MyApp {

let callback = egui::PaintCallback {
rect,
callback: std::sync::Arc::new(move |render_ctx| {
callback: std::sync::Arc::new(move |_info, render_ctx| {
if let Some(painter) = render_ctx.downcast_ref::<egui_glow::Painter>() {
rotating_triangle.lock().paint(painter.gl(), angle);
} else {
Expand Down
13 changes: 7 additions & 6 deletions eframe/examples/custom_3d_three-d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ impl MyApp {
Self {
// three_d: three_d::Context::from_gl_context(cc.gl.clone()).unwrap(),
angle: 0.0,
reuse_three_d: false,
reuse_three_d: true,
}
}
}

impl eframe::App for MyApp {
fn clear_color(&self) -> egui::Rgba {
egui::Color32::from_rgba_unmultiplied(200, 12, 200, 180).into()
}

fn update(&mut self, ctx: &egui::Context, _frame: &eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.horizontal(|ui| {
Expand All @@ -43,7 +47,7 @@ impl eframe::App for MyApp {
ui.checkbox(&mut self.reuse_three_d, "Reuse three-d context");

egui::ScrollArea::both().show(ui, |ui| {
egui::Frame::dark_canvas(ui.style()).show(ui, |ui| {
egui::Frame::canvas(ui.style()).show(ui, |ui| {
self.custom_painting(ui);
});
ui.label("Drag to rotate!");
Expand Down Expand Up @@ -117,7 +121,7 @@ fn paint_with_three_d(three_d: &three_d::Context, info: &egui::PaintCallbackInfo
};

// Create a camera
let mut camera = Camera::new_perspective(
let camera = Camera::new_perspective(
three_d,
viewport,
vec3(0.0, 0.0, 2.0),
Expand Down Expand Up @@ -149,9 +153,6 @@ fn paint_with_three_d(three_d: &three_d::Context, info: &egui::PaintCallbackInfo
// Construct a model, with a default color material, thereby transferring the mesh data to the GPU
let mut model = Model::new(three_d, &cpu_mesh).unwrap();

// Ensure the viewport matches the current window viewport which changes if the window is resized
camera.set_viewport(viewport).unwrap();

// Set the current transformation of the triangle
model.set_transformation(Mat4::from_angle_y(radians(angle)));

Expand Down

0 comments on commit 00ff0a8

Please sign in to comment.