egui/egui_web
Emil Ernerfeldt 8178d23d19
Deduplicate code found in both egui_glium and egui_glow (#819)
* Move window building to egui-winit

* Move icon loading to egui-winit

* `use glow::HasContext;` -> `use glow::HasContext as _;`

* Move FileStorage into epi behind a feature flag

* De-duplicate screen_size_in_pixels and native_pixels_per_point

* Move creation of FileStorage to epi

* Handle epi app output (window size changes etc) in egui-winit

* Move app and memory persistence and autosave logic to egui-winit

* fix check.sh

* Make the epi backend opt-in for egui_glium and egui_glow

* Fix persistence

* Add integration name to epi::IntegrationInfo and the demo

* Clean up Cargo.toml files and fix making egui_glium optional

* fix typo

* Make egui_glium compile without the `epi` feature
2021-10-19 21:40:55 +02:00
..
src Deduplicate code found in both egui_glium and egui_glow (#819) 2021-10-19 21:40:55 +02:00
Cargo.toml Point crate repository & homepage urls to their subfolders 2021-09-03 21:12:44 +02:00
CHANGELOG.md Update egui_glium and egui_web changelogs 2021-10-18 23:13:13 +02:00
README.md rename egui_template to eframe_template 2021-10-18 20:19:43 +02:00

egui_web

Latest version Documentation unsafe forbidden MIT Apache

This crates allows you to compile GUI code written with egui to WASM to run on a web page.

Run the web demo to try it now.

Check out eframe_template for an example of how to set it up.

Downsides with using egui on the web

egui_web uses WebGL and WASM, and almost nothing else from the web tech stack. This has some benefits, but also produces some challanges and serious downsides.

  • Rendering: Getting pixel-perfect rendering right on the web is very difficult, leading to text that is hard to read on low-DPI screens (https://github.com/emilk/egui/issues/516). Additonally, WebGL does not support linear framebuffer blending.
  • Search: you cannot search a egui web page like you would a normal web page.
  • Bringing up an on-screen keyboard on mobile: there is no JS function to do this, so egui_web fakes it by adding some invisible DOM elements. It doesn't always work.
  • Mobile text editing is not as good as for a normal web app.
  • Accessibility: There is an experimental screen reader for egui_web, but it has to be enabled explicitly. There is no JS function to ask "Does the user want a screen reader?" (and there should probably not be such a function, due to user tracking/integrity conserns).
  • No integration with browser settings for colors and fonts.
  • On Linux and Mac, Firefox will copy the WebGL render target from GPU, to CPU and then back again (https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0), slowing down egui.

The suggested use for egui_web is for experiments, personal projects and web games. Using egui for a serious web page is probably a bad idea.

In many ways, egui_web is trying to make the browser do something it wasn't designed to do (though there are many things browser vendors could do to improve how well libraries like egui work).