Clarification on ImTextureRef and calls like ImGui::Image() #8783

Closed
opened 2025-07-09 20:12:37 +00:00 by nurpax · 0 comments
nurpax commented 2025-07-09 20:12:37 +00:00 (Migrated from github.com)

Version/Branch of Dear ImGui:

Version 1.92, Branch: master

Back-ends:

Python bindings integration

Compiler, OS:

Windows 10, Linux, macOS

Full config/build information:

GLFW backend, all OSs.

Details:

My Issue/Question:

I'm working on Python bindings and trying to think how to model the new ImTextureRef in the Python API.

I've read the FAQ on what are ImTextureID/ImTextureRef and also the image loading and displaying wiki page.

I get that when I have a texture and its ID tex_id, I can call ImGui::Image with it like ImGui::Image((ImTextureID)tex_id, ...). This works because the texture ID is implicitly converted to an ImTextureRef with its constructor ImTextureRef(ImTextureID tex_id).

I can't quite wrap my head around the intended use of ImTextureRefs though.

Other than the above implicit conversion, are ImTextureRefs something that'd get normally constructed in user code? Apart from accessing font canvases like io.Fonts->TexRef, all image-rendering cases I can imagine would be served by ImTextureID alone.

### Version/Branch of Dear ImGui: Version 1.92, Branch: master ### Back-ends: Python bindings integration ### Compiler, OS: Windows 10, Linux, macOS ### Full config/build information: GLFW backend, all OSs. ### Details: **My Issue/Question:** I'm working on Python bindings and trying to think how to model the new ImTextureRef in the Python API. I've read the FAQ on what are ImTextureID/ImTextureRef and also the image loading and displaying wiki page. I get that when I have a texture and its ID tex_id, I can call `ImGui::Image` with it like `ImGui::Image((ImTextureID)tex_id, ...)`. This works because the texture ID is implicitly converted to an ImTextureRef with its constructor `ImTextureRef(ImTextureID tex_id)`. I can't quite wrap my head around the intended use of ImTextureRefs though. Other than the above implicit conversion, are ImTextureRefs something that'd get normally constructed in user code? Apart from accessing font canvases like `io.Fonts->TexRef`, all image-rendering cases I can imagine would be served by `ImTextureID` alone.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#8783
No description provided.