Backends: Replace direct access to TextureId with GetTexID() call in ImDrawCmd. (#3761)

This commit is contained in:
thedmd
2021-02-07 12:36:54 +01:00
committed by ocornut
parent e7e170c534
commit 3c72e5142b
14 changed files with 42 additions and 17 deletions

View File

@ -37,6 +37,13 @@ HOW TO UPDATE?
Breaking Changes:
- Backends: Obsoleted direct access to ImDrawCmd::TextureId in favor of calling ImDrawCmd::GetTexID(). (#3761) [@thedmd]
- If you are using official backends from the source tree: you have nothing to do.
- If you copied old backend code or using your own: change access to draw_cmd->TextureId to draw_cmd->GetTexID().
Why are we doing this?
- This change will be required in the future when adding support for incremental texture atlas updates.
- Please note this won't break soon, but we are making the change ahead of time.
Other Changes:
- Scrolling: Fix scroll tracking with e.g. SetScrollHereX/Y() when WindowPadding < ItemSpacing.

View File

@ -370,7 +370,7 @@ ImGui::Image((void*)texture, ImVec2(texture->Width, texture->Height));
The renderer function called after ImGui::Render() will receive that same value that the user code passed:
```cpp
// Cast ImTextureID / void* stored in the draw command as our texture type
MyTexture* texture = (MyTexture*)pcmd->TextureId;
MyTexture* texture = (MyTexture*)pcmd->GetTexID();
MyEngineBindTexture2D(texture);
```
Once you understand this design you will understand that loading image files and turning them into displayable textures is not within the scope of Dear ImGui.