Display Textures in ImGui Windows
Rendering Game Textures
ImGuiMC supports rendering GpuTexture and GpuTextureView objects directly in your ImGui panels. This is useful for displaying item icons, block textures, or custom graphics.
Steps
1. Obtain a texture reference — Get a GpuTexture or GpuTextureView from Minecraft's rendering system. This might come from item stacks, block models, or custom texture atlases.
2. Create an ImGui image element — Use ImGui's image function and pass your texture object as the handle.
3. Set image size — Specify the width and height in pixels for how large the texture should appear in your panel.
4. Optional: Add interaction — Wrap the image in a button or clickable area if you need the player to interact with it.
5. Render and verify — Launch the game and check that your texture displays correctly in the panel.
Textures render at full quality without additional conversion steps. You can display multiple textures in a single window and update them every frame if needed.