egui_backend
crate primarily provides traits to abstract away Window and Rendering parts of egui backends.
this allows us to use any compatible (see WARNING
below) window backend with any render backend crate.
this crate can provides 4 traits:
WindowBackend
: implemented by window backendsOpenGLWindowContext
: specific to Native openGL. Window Backends which support OpengGL can implement this traitGfxBackend<W: WindowBackend>
: implemented by rendering backends for particular or any window backendsUserApp<W: WindowBackend, G: GfxBackend>
: implemented by egui users for a particular combination or any combination of Window or Gfx Backends
look at the docs of the relevant trait to learn more.
WARNING:
the primary goal was to separate window and rendering completely.
It would work for modern graphics api backends like vulkan, metal, dx12 etc..
but for opengl, window parts are often mixed with opengl parts.
for example, opengl needs functions like swap_buffers
, make_context_current
or get_proc_address
which are provided
by the window crates like sdl2 / glfw / glutin. this is made complicated by multi-threading or the fact that opengl context
is often created with a window rather than a separate api etc..
If we remove support for OpenGL, we can simplify this crate A LOT.
TODO: remove OpenGL into a separate crate / trait once webgpu spec is stable
https://developer.chrome.com/en/docs/web-platform/webgpu/ origin trials of webgpu in chrome ends on 1st Feb, 2023.