-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add a bevy-texture example based on wgpu-texture #4360
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
Add a bevy-texture example based on wgpu-texture #4360
Conversation
c1b1c40
to
8e87b54
Compare
Thank you for submitting this! However, it look like this is copying from the bevy |
I think we might want to use a https://docs.rs/bevy/latest/bevy/render/camera/struct.ManualTextureView.html as the render target (or an |
@nicoburns Yes, I am going to fix that. Thanks for the suggestion! I also would like to add a simple camera controller, to showcase how to pass mouse and key events to Bevy. Not sure how I am going to transfer the events yet. |
I am struggling to use ManualTextureView. With this code I am getting the following error:
I've tried storing the Texture and TextureView in the BevyRenderer. Perhaps the problem is that I am using the device from Dioxus to create the texture. I'll see if I can render in a Bevy texture and get its wgpu texture. |
Yes, I had the same problem with the |
If you initialise Bevy RenderPlugin with |
I had a quick look at RenderCreation::Manual but it seems hard to setup so that the Bevy app works normally. I'll give it another go. |
Does this help? DioxusLabs/blitz#232 (you would need to point I think that gives you access to all the types you need. |
Hang on, I'll see if I can hook it up. |
@jerome-caucat Ok, I have RenderCreation::Manual setup. So you should be able to try the texture code again now. |
Signed-off-by: Nico Burns <[email protected]>
Ok, and I also ported the code you posted above (sorry - I got excited!). Seems to be working! I'm not sure if it is correctly responding to resizes: the |
@nicoburns Thanks a lot for your help. I was also updating the code on my side. I'll clean the code and fix the remaining issues. |
Awesome. Now I've unblocked you, I'll stop interfering and let you get on with it :) |
I've published a new versions of the |
@nicoburns I cleaned the code, added some comments, fixed the resize problem and renamed the example. I noted there is a segfault when we close the window, but the I wanted to add mouse and keyboard events to this demo, but perhaps I should do this in a separate issue. |
Signed-off-by: Nico Burns <[email protected]>
Signed-off-by: Nico Burns <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerome-caucat All looks good to me. Just need to fix the issues with CI and then we can land this. Long-term we may want to move this into a separate repo (as this one is already a very large workspace, and pulling in the whole of Bevy just for an example is quite a lot). But lets land it here first, and we move it and improve on it later.
I noted there is a segfault when we close the window, but the wgpu-texture example has the same issue.
Not ideal, but not disastrous in an example. If the wgpu-texture
example has the same problem let's not block this PR on it.
I wanted to add mouse and keyboard events to this demo, but perhaps I should do this in a separate issue.
Yeah, let's do a new issue/PR. This will likely require further changes in the Blitz layer.
In order to integrate Bevy with Dioxus, I adapted the
wgpu-texture
example to use Bevy for the 3D rendering.I added a new
bevy-texture
example where:dioxus_native
custom paint source.Screencast.from.2025-07-03.15-22-42.webm
closes #4359