ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.87k stars 304 forks source link

Rendering renderer image to an ImGui window #346

Open NikolayKanchevski opened 2 years ago

NikolayKanchevski commented 2 years ago

I would first like to thank you for this incredible binding!

However, I am having trouble adding a custom image to ImGui. I am using pure Vulkan and have created a custom ImGui controller, as the one shown on the repository is specifically for Veldrid. I would be grateful if you could point me to how I can have an image passed to an ImGui window without having the current problem I have - for some reason, the font image gets combined with the image I want to draw, creating a mess. Same thing for the font itself - the letters are using a combination of the font image and the image I want to draw. Here is what I am seeing:

https://imgur.com/ofGCmb3

What I do is the following:

  1. Create the Vulkan image
  2. Create a descriptor for the image using a universal sampler
  3. foreach (var imageDescriptor in imageDescriptors) vkCmdBindDescriptorSets() and vkCmdDrawIndexed()

Then, when I want to display an image I do: if (ImGui.Begin()) ImGui.Image((IntPtr) someVulkanImage.handle)

Thank you in advance!