-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Example of rendering a dioxus-native app to a texture #4365
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
Conversation
a72f160 to
303816d
Compare
303816d to
17c4e29
Compare
Signed-off-by: Nico Burns <[email protected]>
Signed-off-by: Nico Burns <[email protected]>
17c4e29 to
ea8eac7
Compare
|
@jerome-caucat I've updated this to use the new |
|
@nicoburns Thank you for this example. I've started implementing an example rendering dioxus-native to a texture in bevy: native-headless-in-bevy However, I'm running into an issue: the content of the Dioxus app ( The VelloRenderer is rendering to the texture — I can confirm this because:
Would you happen to have an idea of what is going on, or how I could debug this? EDIT: More info:
|
|
On vacation this week. But I think you need to call .resolve() on the inner BaseDocument before rendering (this was missing from my example). This should be called every frame. |
@nicoburns Thanks, this helped, but I also had to add a call to let mut dioxus_doc = DioxusDocument::new(vdom, None);
dioxus_doc.initial_build();
dioxus_doc.set_viewport(Viewport::new(WIDTH, HEIGHT, SCALE_FACTOR, COLOR_SCHEME));BTW the call to I'll handle some event and submit a PR once I have a working example. |
|
Glad you've got it working! @jkelleyrtp Can you remember why you removed the call to "initial_build" from "new", and made it a separate method? Perhaps there is something that needs to be done in between in some use cases? |
This is because we need to set up the virtualdom and inject the window context into it before the first render. See this code: |
Created in answer to #4362
Some notes:
dioxus-native-domcrate which contains the Dioxus <-> Blitz integration without the event loop / winit bits.Dioxus Native isn't really set up for this yet (just hasn't been something we've really worked on). So there's definitely room for improvement.