Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose glow::Context via epi::Frame #1198

Closed
emilk opened this issue Feb 2, 2022 · 2 comments · Fixed by #1351
Closed

Expose glow::Context via epi::Frame #1198

emilk opened this issue Feb 2, 2022 · 2 comments · Fixed by #1351
Labels
eframe Relates to epi and eframe egui_glow Relates to running egui_glow on native feature New feature or request web Related to running Egui on the web

Comments

@emilk
Copy link
Owner

emilk commented Feb 2, 2022

Since we are converging on using glow as the rendering backend for eframe on both native and web, it would be quite useful to expose the glow GL context to the user, in particular in order to do paint-to-texture from within eframe.

This would need to be opt-in thing though (optional dependency of epi) and be fallible (e.g. frame.glow_context() should return None if we aren't using a glow renderer).

This would obviously be for advanced users.

I'm not sure if there is interest in this though. My thinking is that if one wants to do 3D stuff with egui, one should probably use bevy_egui, egui-macrquad, or similar. Still, eframe has many features these libraries lack (reactive mode, better i/o on web).

@emilk emilk added feature New feature or request web Related to running Egui on the web eframe Relates to epi and eframe egui_glow Relates to running egui_glow on native labels Feb 2, 2022
@coderedart
Copy link
Contributor

there could be some considerations for the still imaginary multi-window feature. gl contexts are usually per window.
I don't see any negatives here. as long as it is marked unsafe, those who want to experiment can do so. some more questions:
does the user get to request a specific version of opengl (4.6?) at the start of program?
what state is okay to change (since its all global) eg: drawing into texture means changing framebuffers/attachments and maybe more exotic stuff like polygon mode /depth test / stencil test which egui doesn't set every frame right now.

there could be a slight chance that people will be hitting discord with a lot of opengl questions and we might need to pin renderdoc download link at the top

@emilk
Copy link
Owner Author

emilk commented Mar 10, 2022

I'm now looking into adding a custom Shape with a callback to which the glow context will be passed. That would allow users to embed 3D stuff and other custom painting directly into an egui Ui. This will be similar to how Dear ImGui has AddCallback/UserCallback

emilk added a commit that referenced this issue Mar 11, 2022
eframe will now always use egui_glow as a native backend.

Part of #1198
emilk added a commit that referenced this issue Mar 11, 2022
eframe will now always use egui_glow as a native backend.

Part of #1198
emilk added a commit that referenced this issue Mar 11, 2022
eframe will now always use egui_glow as a native backend.

Part of #1198
emilk added a commit that referenced this issue Mar 11, 2022
…#1356)

* egui_web: always use the glow painter, and remove the old WebGL code.
* Clean up the WebPainter trait
* Clarify WebGL1 warning text in color test

The glow painter became standard in egui 0.17, and I've heard no complaints! So let's simplify and go all in on glow.

Part of #1198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eframe Relates to epi and eframe egui_glow Relates to running egui_glow on native feature New feature or request web Related to running Egui on the web
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants