Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blurry egui #1266

Merged
merged 6 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/fj-viewer/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ impl Gui {

pub(crate) fn update(
&mut self,
pixels_per_point: f32,
egui_input: egui::RawInput,
config: &mut DrawConfig,
aabb: &Aabb<3>,
status: &StatusReport,
line_drawing_available: bool,
) {
self.context.set_pixels_per_point(pixels_per_point);
self.context.begin_frame(egui_input);

let bounding_box_size = {
Expand Down
5 changes: 3 additions & 2 deletions crates/fj-viewer/src/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Viewer {
/// Draw the graphics
pub fn draw(
&mut self,
scale_factor: f32,
pixels_per_point: f32,
status: &mut StatusReport,
egui_input: egui::RawInput,
) {
Expand All @@ -132,6 +132,7 @@ impl Viewer {
self.camera.update_planes(&aabb);

self.gui.update(
pixels_per_point,
egui_input,
&mut self.draw_config,
&aabb,
Expand All @@ -142,7 +143,7 @@ impl Viewer {
if let Err(err) = self.renderer.draw(
&self.camera,
&self.draw_config,
scale_factor,
pixels_per_point,
&mut self.gui,
) {
warn!("Draw error: {}", err);
Expand Down
9 changes: 4 additions & 5 deletions crates/fj-window/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,13 @@ pub fn run(
viewer.handle_screen_resize(size);
}

let pixels_per_point = window.window().scale_factor() as f32;

egui_winit_state.set_pixels_per_point(pixels_per_point);
let egui_input =
egui_winit_state.take_egui_input(window.window());

viewer.draw(
window.window().scale_factor() as f32,
&mut status,
egui_input,
);
viewer.draw(pixels_per_point, &mut status, egui_input);
}
_ => {}
}
Expand Down