Alternative API of eframe / epi #1589
Replies: 4 comments
-
This is not really important, but thought it is better to document this idea somewhere rather than forget it. AFAIK, this doesn't even have to be officially part of egui if it feels unnecessary, it could be a separate project / repo. |
Beta Was this translation helpful? Give feedback.
-
so, i made a proof of concept . this could be improved even more if we ignore opengl and only concentrate on newer API like vk, dx, metal. eframe can just use winit and glow as backends and it won't even be a breaking change AFAIK. |
Beta Was this translation helpful? Give feedback.
-
I don't have the mental bandwidth to think about this too hard right now, but here is a short summary of my thoughts: It would be really nice to be able to freely combine different windowing and rendering engines. I have been itching to try out both SDL2 and tao, for instance. I am worried that it will be very difficult thing to find the right abstraction layer without building another windowing abstraction layer on top of winit, sdl2, tao, etc. I also worry that if However, I never wanted to build a windowing framework, I only have done so in order to easily build portable egui applications. If someone else writes a better framework than |
Beta Was this translation helpful? Give feedback.
-
Understood. I will keep this as a separate project and try to polish it a little more. |
Beta Was this translation helpful? Give feedback.
-
Current API
epi has an
App
trait. this abstracts over both the windowing backend and rendering backend. eframe doesn't expose either of them directly, but rendering is now partially exposed via the PaintCallBacks now.Limitations
NativeOptions
struct grows by every version.epi::App
trait and when they use it, they need to limit themselves to a specific window + gfx api combination.Alternative API
The primary goal is to separate the rendering from windowing functionalities completely.
Have a
WindowBackend
andGfxBackend
traits like you an see at https://github.com/coderedart/etk/blob/master/crates/egui_backend/src/lib.rs .swap_buffers
orget_proc_address
etc..GfxApiConfig
this is given to window backend to set the right options before window creation
WindowInfoForGfx
returned by Window backend after creation.
OpenGLWindowContext
some functions require by opengl renderers are usually provided by windowing backends and not available with opengl raw context itself. only for openGL usecase.
with that, we have separated the data required by Windows and Renderers.
WindowBackend
GfxBackend
UserApp
Finally, we have the trait that serves as the replacement for the current
epi::App
In the end, it all comes down to
the rough event loop workflow happens like this. literally copy-pasted from glfw
Advantages
three_d
backend orrend3
backend too and it would be really easy for users to use them instead of aiming for custom implmentations.Beta Was this translation helpful? Give feedback.
All reactions