egui_glow: add SDL2 and others as an alternative to glutin
- Dominant language
- Rust
- Stars
- 30.6k
- Forks
- 2.1k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 67
Description
**Is your feature request related to a problem? Please describe.**
`egui_glow` is currently forced to use `glutin`/`winit`, despite the fact that most of the important code (`painter.rs`) is pretty decoupled from that. This could lead to duplication when people create forks/separate crates for different backends, such as SDL2.
**Describe the solution you'd like**
A feature flag `sdl2` that replaces the context/windowing code with SDL2.
This could later be adapted to other backends such as WebGL, or GLFW.
**Describe alternatives you've considered**
We could also remove all windowing/context code entirely from `egui_glow` crate, moving the functionality to `egui-winit` and alternative `egui-sdl2` that both handle all of the windowing/context. I think this would be less clean because some users of `egui-winit` do not need an OpenGL context, and `glium` automatically creates the context (and does not support SDL2)
It might instead be worth splitting `egui_glow` so it only contains OpenGL code, and have a separate crate to fill in to generate context (through fullfilling a trait perhaps).
**Additional context**
This is only really possible to implement once as much shared code as possible has been removed from the two official backends, so it's simpler to implement cleanly.
`glium` does not support SDL2, so it's off the table.
There are a lot of ways to go about doing this, so I'd be interested to hear your thoughts on if this is a worthwhile feature to implement, and how best to do it if so.
Contributor guide
Assessment
This issue has not been assessed yet.