Prevent background redraw for transparent widget (embedding wgpu inside druid)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.7k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am trying to write a small proof of concept of embedding a `wgpu` surface inside a druid app, as a custom widget. I've started druid yesterday and I am really liking this project, but would like to make sure it is possible to render a 3D view inside a desktop app. The typical use case is a 3D viewport with some 2D UI around it (think something like a game editor / Unity3D / UnrealEngine, or any CAD application, or some 3D modeller like Maya or Max).
I've started from the `multiwin` example and _lightly_ modified druid for `WindowHandle` to implement the `HasRawWindowHandle` trait, which allow creating a `wgpu` instance from it (is that of interest for #891 by the way? the patch is 10 lines (Windows only)). Then I more or less copy-pasted the "cube" example of `wgpu-rs` into the `multiwin` example of druid.
Now it *almost* works, but it seems that some background redraw is still active, so I cannot get a stable image. When the mouse moves out and in of the window borders, or other repaint is triggered, I briefly see the 3D cube, but then immediately get back the normal 2D druid UI on top of it.
Does someone has any idea how I could fix this, or could point me in the direction of where widgets are cleared? I don't do that background repaint myself. I've tried with `PaintCtx::paint_with_z_index(9999)` but that doesn't work either.
Many thanks for any pointer! :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from the modified multiwin example, using the wgpu cube example and the WindowHandle and PaintCtx::paint_with_z_index(9999) details as starting points. Trace when the druid UI is cleared or redrawn after mouse movement or another repaint; done means the embedded 3D view remains stable instead of being covered by the 2D UI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100