Commit graph

102 commits

Author SHA1 Message Date
Emil Ernerfeldt
898f4804b7 Enable and fix a bunch more lints 2022-07-11 23:08:48 +02:00
Emil Ernerfeldt
c062bca6ee faster builds: remove tracing-attributes feature from tracing 2022-07-04 00:11:08 +02:00
Red Artist
935913b1ec
Add Context::request_repaint_after (#1694) 2022-06-22 13:19:13 +02:00
Emil Ernerfeldt
29973e5d02 Make document-features an opt-in dependency 2022-06-09 17:41:37 +02:00
Emil Ernerfeldt
3169ce62d5
Document feature flags using crate document-features (#1725) 2022-06-09 15:27:22 +02:00
Emil Ernerfeldt
2771c8c3e5 Fix doclinks 2022-05-28 18:09:08 +02:00
Zicklag
1d9524cc59
Re-implement PaintCallbacks With Support for WGPU (#1684)
* Re-implement PaintCallbacks With Support for WGPU

This makes breaking changes to the PaintCallback system, but makes it
flexible enough to support both the WGPU and glow backends with custom
rendering.

Also adds a WGPU equivalent to the glow demo for custom painting.
2022-05-28 17:52:36 +02:00
Robert Bragg
a5076d4cc4
egui_winit/wgpu: enable Android support (#1634)
* egui-winit: don't assume window available at init

On Android in particular we can only initialize render state once we
have a native window, after a 'Resumed' lifecycle event. It's still
practical to be able to initialize an egui_winit::State early on
so this adds setters for the max_texture_side and pixels_per_point
that can be called once we have a valid Window and have initialized
a graphics context.

On Wayland, where we need to access the Display for clipboard handling
we now get the Display from the event loop instead of a window.

* egui-wgpu: lazily initialize render + surface state

Enable the renderer and surface state initialization to be deferred
until we know that any winit window we created has a valid native window
and enable the surface state to be updated in case the native window
changes.

In particular these changes help with running on Android where winit
windows will only have a valid native window associated with them
between Resumed and Paused lifecycle events, and so surface creation
(and render state initialization) needs to wait until the first
Resumed event, and the surface needs to be dropped/recreated based on
Paused/Resumed events.
2022-05-22 20:24:41 +02:00
Sebastian Urban
b2510676b9
Take Glow context using Arc. (#1640)
This allows usage with a Glow context that is passed between threads.
2022-05-22 17:43:30 +02:00
Emil Ernerfeldt
a29154233b Add support for texture filters in WGPU backend 2022-05-22 17:40:56 +02:00
Zicklag
1a9a0d7ec8
Add the Ability to Specify Egui Texture Filters (#1636)
Only works for egui_glow
2022-05-22 16:56:51 +02:00
Emil Ernerfeldt
f3e305a646 Replace TODO: with TODO(emilk): and update code guidelines 2022-05-21 16:53:25 +02:00
Emil Ernerfeldt
3d5e203d86
egui_glow: clear the post-processing render target (#1658) 2022-05-21 16:53:05 +02:00
Emil Ernerfeldt
32ad9c29be Use better names in glow::Painter 2022-05-21 16:03:26 +02:00
Emil Ernerfeldt
931e716b97
Add egui_wgpu crate (#1564)
Based on https://github.com/hasenbanck/egui_wgpu_backend

`egui-wgpu` is now an official backend for `eframe` (opt-in).

Use the `wgpu` feature flag on `eframe` and the `NativeOptions::renderer` settings to pick it.

Co-authored-by: Nils Hasenbanck <nils@hasenbanck.de>
Co-authored-by: Sven Niederberger <niederberger@embotech.com>
Co-authored-by: Sven Niederberger <73159570+s-nie@users.noreply.github.com>
2022-05-12 09:02:28 +02:00
Emil Ernerfeldt
d69ce546fa Release egui_glow 0.18.1 - remove unnecessary calls to gl.get_error 2022-05-09 12:43:37 +02:00
Emil Ernerfeldt
e82b87ca73
Remove calls to gl.getError in release builds (#1583)
This slows down the web version a lot, especially on some browsers

Publish new web demo
2022-05-05 23:17:33 +02:00
Emil Ernerfeldt
dc26890a80 Release 0.18.0 - Shape::Callback, Table, and better text contrast 2022-04-30 20:27:27 +02:00
Emil Ernerfeldt
1983d19614 eframe: fix wrong clear color on native 2022-04-30 15:42:35 +02:00
Emil Ernerfeldt
3a83a600bb
Add a custom 3D demo using glow to egui_demo_app (#1546) 2022-04-30 12:58:29 +02:00
Emil Ernerfeldt
bb421c7e8a
Remove egui_web and epi (#1545)
* Remove integration name (it is always eframe)

* Remove egui_web crate

* Move egui_web/CHANGELOG.md into eframe/CHANGELOG.md

* Remove all mentions of egui_web

* Remove epi crate and absorb into eframe

* egui_glow: only use puffin on native

* Remove WASM doc from CI (we don't generate it anyways!)

* Remove eframe::epi and improve eframe docs
2022-04-30 10:44:35 +02:00
Emil Ernerfeldt
ed002acc68
Refactor: move things into eframe (#1542)
* Move all epi-related code from egui_glow into eframe

* Move epi stuff from egui-winit into eframe

* Remove mention of epi in egui

* Remove mention of epi in egui_glium

* Remove trait epi::NativeTexture

* Remove confusing mentions of epi

* Refactor egui_web: break up into smaller files

* Clean up feature flags further, and update changelogs

* Clean up check.sh

* Small cleanup of egui_web/Cargo.toml

* Fix dependencies for pure_glow example

* Fix clippy false positive
2022-04-29 08:17:49 +02:00
Emil Ernerfeldt
4d2eb5b71e Don't export macros that should only be pub(crate) 2022-04-25 22:01:32 +02:00
Emil Ernerfeldt
5a78213421
Enable depth buffer in WebGL backend (#1499)
This is useful when embedding 3D into eframe using egui::PaintCallback
2022-04-15 12:41:42 +02:00
Emil Ernerfeldt
f3e31391e0 Pass clip rectangle to PaintCallback 2022-04-15 10:31:33 +02:00
Emil Ernerfeldt
a7b6334784 Misc doc improvements 2022-04-13 22:14:34 +02:00
Emil Ernerfeldt
170b21b63e
Add opt-in support for the 'puffin' profiler in eframe (#1483) 2022-04-13 11:06:13 +02:00
Emil Ernerfeldt
917f9e1768 Refactor and simplify feature flags 2022-04-11 10:53:16 +02:00
Emil Ernerfeldt
cf0338d48f
Rust 1.60.0 + refactor cargo features (#1467)
* Update to rust 1.60.0
* Rename the feature `convert_bytemuck` to `bytemuck`
* Rename the feature `serialize` to `serde`.
* Make use of the "weak dependency" cargo feature
* Set rust-version = "1.60" for all crates
* egui_glow: clipboard, links, persistence & winit are now opt-in features
2022-04-09 13:54:47 +02:00
Emil Ernerfeldt
7cd285ecbc misc clippy fixes from 1.60.0 2022-04-07 17:03:19 +02:00
Emil Ernerfeldt
10f30a0c52
Fix tessellation of Shape::Vec of heterogenous TextureId:s (#1445)
Closes https://github.com/emilk/egui/issues/1443
2022-04-03 18:14:27 +02:00
Emil Ernerfeldt
95efbbc03e
Remember to update glow window size when DPI changes (#1441) 2022-04-03 10:20:49 +02:00
Collin Kemper
a52bbade45
Place dark-light behind a feature gate in eframe and egui_glow (#1437) 2022-04-01 11:10:47 +02:00
Emil Ernerfeldt
8f178fa4e0
Add glow::Context to epi::Frame (#1425)
This can be used, for instance, to:

* Render things to offscreen buffers.
* Read the pixel buffer from the previous frame (glow::Context::read_pixels).
* Render things behind the egui windows.
2022-03-27 15:20:45 +02:00
Emil Ernerfeldt
b7ebe16cfb
Storage and frame refactor (#1418)
The purpose of this is to expose `frame.storage()` and `frame.storage_mut()` so users can save/load app state from the `App::update` function, without having to add another parameter to that function.

Changes:
* Added `Frame::storage()` and `Frame::storage_mut()`
* `App::update` now takes a `&mut Frame` rather than just `&Frame`
* `Frame` is no longer `Clone` or `Sync` (doesn't have to be since https://github.com/emilk/egui/pull/1366)
2022-03-25 21:19:31 +01:00
Emil Ernerfeldt
8272b08742
Improve text contrast in bright mode (#1412)
* Rename AlphaImage to FontImage to discourage any other use for it
* Encode FontImage as f32 and postpone the alpha correction
* Interpret alpha coverage in a new, making dark text darker, improving contrast in bright mode
2022-03-23 16:49:49 +01:00
Emil Ernerfeldt
3e41da7187 Revert accidentally setting srgb option on glutin window based on vsync
Introduced in a9fd03709e
2022-03-23 13:04:12 +01:00
Emil Ernerfeldt
a9fd03709e Add new NativeOptions: vsync multisampling depth_buffer stencil_buffer
These are useful when embedding 3D into eframe.
2022-03-23 11:13:57 +01:00
Emil Ernerfeldt
85e3ec5027 Log supported OpenGL extensions if VAO is in doubt. 2022-03-23 10:10:12 +01:00
Emil Ernerfeldt
ea9393aa9b
glow painter improvements (#1406)
* Add viewport info to PaintCallback
* glow: be more explicit with more state
* glow: Refactor VAO
2022-03-22 23:11:27 +01:00
Emil Ernerfeldt
6f10e2e725
Improve glow error reporting (#1403)
* Improve glow error reporting
* Add more check_for_gl_error calls
* Remove clippy lint list from egui_glow lib.rs
  - Forgotten in https://github.com/emilk/egui/pull/1394
* egui_glow: move vao code to own file
* Cleanup: `use glow::HasContext as _;`

Co-authored-by: Zachary Kohnen <me@dusterthefirst.com>
2022-03-22 16:04:06 +01:00
Emil Ernerfeldt
41b178b6ec
Use atomic_refcell instead of parking_lot for wasm32 targets (#1404)
Closes https://github.com/emilk/egui/issues/1401
2022-03-22 15:34:21 +01:00
Emil Ernerfeldt
15254f8235
Remove the single_threaded/multi_threaded feature flags (#1390)
Always use parking_lot for mutexes, i.e. always be multi-threaded.

Closes #1379
2022-03-21 22:20:37 +01:00
Emil Ernerfeldt
5c68edbb15 Clippy fixes 2022-03-21 22:14:25 +01:00
Emil Ernerfeldt
e369626d3d glow: move where FRAMEBUFFER_SRGB is enabled 2022-03-20 23:04:44 +01:00
Emil Ernerfeldt
f6af7bda27 Better error message when trying to upload too large texture
Closes https://github.com/emilk/egui/issues/1370
2022-03-19 13:30:29 +01:00
Emil Ernerfeldt
c8f6cae362
eframe app creation refactor (#1363)
* Change how eframe apps are created
* eframe: re-export epi::* so users don't need to care about what epi is
2022-03-16 15:39:48 +01:00
Emil Ernerfeldt
c768d1d48e
Context::request_repaint will wake up the UI thread (#1366)
This adds a callback (set by `Context::set_request_repaint_callback`)
which integration can use to wake up the UI thread.

eframe (egui_web and egui_glow) will use this, replacing
`epi::Frame::request_repaint`.

Existing code calling `epi::Frame::request_repaint` should be changed
to instead call `egui::Context::request_repaint`.

This is the first callback added to the egui API, which otherwise is
completely driven by data.

The purpose of this is to remove the confusion between the two
`request_repaint` methods (by removing one). Furthermore, it makes
`epi::Frame` a lot simpler, allowing future simplifications to it
(perhaps no longer having it be `Send+Sync+Clone`).
2022-03-15 17:21:52 +01:00
Emil Ernerfeldt
6aee4997d4
Add Shape::Callback to do custom rendering inside of an egui UI (#1351)
* Add Shape::Callback to do custom rendering inside of an egui UI
* Use Rc<glow::Context> everywhere
* Remove trait WebPainter
* Add glow::Context to epi::App::setup
2022-03-14 13:25:11 +01:00
Emil Ernerfeldt
510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +01:00