-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
egui-wgpu on web #1755
Comments
Yep, but it's currently locked to using webgl and not webgpu: Line 43 in bd5f553
We'd just need to remove this feature to get it work for both backends |
I assume this cannot be done as easily as |
We are using egui-wgpu successfully on wasm (with the webgl2 backend currently, though i don't think it should be different for webgpu). We have an existing wgpu context and custom event loop, input events etc (driven by typescript side), i'm not au fait with how eframe does it, but we followed the 'integrations' part of the eframe repo and got it up and running fairly seamlessly. Which bit are you struggling with in particular? @Titaniumtown |
I managed to create a minimum working example using egui-wgpu with a wgpu backend and wasm32 target, see https://github.com/geolehmann/egui-wgpu_wasm_example (event handling is not yet included), which took me way longer than it should. I had to use my own fork of egui tho with some fixes (I used some code from the fork of @expenses ). I also found another working example: https://github.com/pierscowburn/egui_wgpu_failure_case, but here still the older egui-wgpu-backend crate is used. |
@geolehmann thanks for that example! I notice that you use winit (and egui-winit) on the web, which is interesting (see #1032). |
I have done my own barebones integration of egui on top of a 'raw' wgpu app originally based on the 'learn wgpu' tutorials. this runs on native and in browser via WASM wth wgpu (no webgl fallback). I also have hooked up basic mouse move and button click events as i required them. I dont really have a 'releaseable' example app i can publish (and I use camel case which likely makes me an heretic in the wider rust community) but, in case its a helpful to anyone - my renderers state struct has the following added:
these are initialised as follows:
and the main part of the rendering looks like:
example of input gathering from the existing winit handlers is:
I am a bit of a rust newbie (Most of my experience in this sort of thing is with raw Vulkan and C++) so have just followed my nose as to how to make this work, but this produces a usable gui overlaid on top of my existing 3d rendered output. If anyone else wants to try the same approach i'm happy to provide more detail |
@metacean please use backticks for code
|
How could one use the wgpu integration for egui on wasm? I can't find a way to do this. Is this possible?
The text was updated successfully, but these errors were encountered: