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

[Web Demo] Blurry rendering when browser window has odd width / height #103

Closed
daniel5151 opened this issue Jan 8, 2021 · 7 comments · Fixed by #151
Closed

[Web Demo] Blurry rendering when browser window has odd width / height #103

daniel5151 opened this issue Jan 8, 2021 · 7 comments · Fixed by #151
Labels
bug Something is broken good first issue Good for newcomers help wanted Extra attention is needed web Related to running Egui on the web

Comments

@daniel5151
Copy link

Consider this side-by-side comparison of the basic demo pane:

egui-crisp egui-blurry

The left screenshot was taken in a browser window with dimensions 1000px x 1200px, while the one on the right was taken in a browser window with dimensions 1001px x 1200px. i.e: a difference of one pixel resulted in the entire image becoming significantly blurrier.

A similar issue occurs when the window's height is odd, albeit to a lesser extent.

Tested in Google Chrome Version 87.0.4280.88 on Ubuntu 20.10 with NVIDIA Drivers

@emilk emilk added bug Something is broken web Related to running Egui on the web labels Jan 11, 2021
@emilk
Copy link
Owner

emilk commented Jan 11, 2021

Good find - I can reproduce in Firefox on Mac too. Maybe a simple fix is to just round down the canvas size to the nearest multiple-of-2.

@emilk
Copy link
Owner

emilk commented Jan 17, 2021

I was gonna fix this now, but can no longer reproduce it. Weird :/

@bugadani
Copy link

I can :)
image
MS Edge, version 87.0.664.75

@emilk
Copy link
Owner

emilk commented Jan 24, 2021

Anyone want to take a stab at this? I can't reproduce on my machine, so I can't.

I'm guessing we need to add some rounding in https://github.com/emilk/egui/blob/master/egui_web/src/lib.rs#L117:L141

My theory is that we need to round (or rather floor) the height and width to the next factor-of-2 in pixel or in point size. Or maybe just round to the nearest integers.

@bugadani
Copy link

bugadani commented Jan 24, 2021

Well for me (at least on firefox, which I don't use, LOL) was to turn off webgl antialiasing in about:config. The option is not available in Edge (chromium) though, so this is only food for thought. Also, my head hurts from staring at blurry text :)

I'm suspecting this issue is only present on non-high DPI only.

On
image

Off
image

@emilk emilk added the help wanted Extra attention is needed label Jan 26, 2021
@crumblingstatue
Copy link
Contributor

I can reproduce this on chromium 88, and I can confirm it only happens on odd width/height. Unfortunately the height is odd when my browser is maximized. If anyone wants me to test something, let me know.

@aakamenov
Copy link
Contributor

I've submitted a PR for this - #149 . Managed to reproduce and fix on Edge and Opera (both Chromium), but should be fixed on other browsers. If anyone was getting this on Firefox or Chrome, would be nice to confirm that it doesn't occur anymore.

emilk added a commit that referenced this issue Feb 1, 2021
@emilk emilk closed this as completed in #151 Feb 1, 2021
emilk added a commit that referenced this issue Feb 1, 2021
* [egui_web] Always use an even canvas size

Fixes #103

* [egui_web] Position canvas at top of screen

This avoids jumpyness when resizing,
caused by rounding height to an even number
ingo-budde pushed a commit to ingo-dsp/egui that referenced this issue Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken good first issue Good for newcomers help wanted Extra attention is needed web Related to running Egui on the web
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants