Yatekii / imgui-wgpu-rs

Dear imgui renderer for wgpu-rs.
MIT License
256 stars 84 forks source link

create texture for use with imgui::Image #24

Closed luke-titley closed 4 years ago

luke-titley commented 4 years ago

Hey, I'm rendering to a wgpu texture and I would like to be able to display it with imgui::Image. There's no obvious way for me to create this texture using imgui-wgpu-rs. If there is a way, can you please tell me? Otherwise, would you accept a pull request which adds this?

Thanks, Luke

Yatekii commented 4 years ago

I am not sure how one would do this :/ We have support for custom textures in imgui-wgpu, but I think for diplaying it in an Image might need additional bits. I'll happily accept a PR :)

luke-titley commented 4 years ago

You're already using imgui::Image in custom textures. The only difference is, I don't want to upload data. I want to render to the texture using wgpu. It's for making a viewport. I need both the imgui::TextureId and also the wgpu::Texture. The TextureId for imgui::Image and the wgpu::Texture, so that I can render to it directly.

luke-titley commented 4 years ago

Maybe I'll just tinker with the Renderer::upload_texture and Texture struct, and see what I can come up with ... unless I'm being really stupid and there's another way.

Yatekii commented 4 years ago

Fixed in #25.