Walnut icon indicating copy to clipboard operation
Walnut copied to clipboard

Can the Image.cpp load models ?

Open linuxing3 opened this issue 3 years ago • 3 comments

Walnut is awesome. The Image.h and Image.cpp simplify a lot rendering images. Is the any sample code about how to use walnut to load models and textures? Thanks!

linuxing3 avatar Dec 05 '22 11:12 linuxing3

This may be unrelated, but can I ask for some guidance on how to load and render image files in Walnut? I have been struggling with it and could use some help.

erdem0818 avatar Jul 28 '23 20:07 erdem0818

To my understanding you may just use Imgui::Image("image.png", {witdth, height}) to load and show image in a imgui window.

If you prefer to use Image.cpp to load image data in Gpu, just do this in your renderer.cpp:

auto img = Image("image.png");

and in imgui window:

ImGui::Image(m_Image->GetDescriptorSet(), { (float)m_Image->GetWidth(), (float)m_Image->GetHeight() });

linuxing3 avatar Jul 29 '23 10:07 linuxing3

thanks a lot

erdem0818 avatar Jul 29 '23 11:07 erdem0818