mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Backends: Replace direct access to TextureId with GetTexID() call in ImDrawCmd. (#3761)
This commit is contained in:
@ -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.
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user