iced icon indicating copy to clipboard operation
iced copied to clipboard

Add wgpu custom rendering example

Open mvilim opened this issue 2 years ago • 0 comments

wgpu custom rendered widget example

Hi! I am returning to #903, and I realized that the existing layout information is sufficient to appropriately locate a custom render pass with the rest of the UI. I have put together this PR with an example that demonstrates a custom rendered widget.

This solution is effectively option 4 from #903; it's just that necessary information was already mostly exposed. It's a bit hacky, since it captures the contents of the layout argument to the widget draw call. It's only possible in projects that directly integrate with wgpu (such as the integration_wgpu example, from which my example is derived), and such projects already want to have fine control over their rendering.

Despite its slight hackiness, this seems like a perfectly sufficient solution for my use case. Do you think this example is worth including in the repo? If the overall approach is appropriate, but the particular method of extracting the layout from the draw call is too hacky, then perhaps I can instead make some extensions to iced so that the layout of a given widget can be queried.

mvilim avatar Aug 20 '21 20:08 mvilim