Skip to content

fix: line rendering with ImGui v1.93+ - #195

Open
brenocq wants to merge 1 commit into
mainfrom
fix/imgui-v193
Open

fix: line rendering with ImGui v1.93+#195
brenocq wants to merge 1 commit into
mainfrom
fix/imgui-v193

Conversation

@brenocq

@brenocq brenocq commented Aug 6, 2026

Copy link
Copy Markdown
Owner

ImGui 1.93.0's ImDrawList rework changed the layout of the baked anti-aliased line
texture table (ImDrawListSharedData::TexUvLines[], now (u0, u1, v, 1/thickness)) and
selects entries through the new ImDrawList::_SelectLineTexture() helper. ImPlot3D reads
that table directly in GetLineRenderProps(), so against ImGui ≥ 1.93 it picked the wrong
UVs and anti-aliased lines rendered incorrectly / were not visible.

This ports the upstream ImPlot fix to ImPlot3D.

Changes

  • GetLineRenderProps() now mirrors ImDrawList::_SelectLineTexture() for the new
    TexUvLines[] layout and adds the anti-aliasing fringe to half_weight.
  • Since ImDrawList3D is not an ImDrawList, the selection logic is inlined against
    _SharedData (with _FringeScale == 1) instead of calling the method.
  • Guarded with #if IMGUI_VERSION_NUM >= 19299 || defined(IM_DRAWLIST_TEX_LINES_SAMPLE_COUNT);
    the pre-1.93 path is kept unchanged for older ImGui.

References

  • Ports ImPlot #712 – Refactor: update to upcoming v1.93 changes
    (commit 7eeb916, "use ImDrawList::_SelectLineTexture()").
  • ImGui ocornut/imgui#9504 – the ImDrawList v1.93 changes.
  • ImPlot #711 (AddLineH() / AddLineV() wrappers,
    added in ImGui 1.92.8) is not ported: every ImPlot3D line is a 3D-projected segment at an
    arbitrary screen angle, so there are no axis-aligned AddLine() calls to replace.

@brenocq brenocq self-assigned this Aug 6, 2026
@brenocq brenocq added type:fix Something isn't working prio:high High priority status:review The task is under review labels Aug 6, 2026
@ocornut

ocornut commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Hmm it feels like we could decide to redesign the function to be part of ImDrawListSharedData.
I think it could wait until we finish some work on making baked corner dynamic as it may further changes a few things, and until then you can use this code. As soon as we change it (if we do) i'll let you know.

About hard-coding fringe to 1.0f.
Do you have a Mac?
Unfortunately Mac style scaling works a bit differently.
draw_list::_SetPixelDensity() is called once a frame per drawlist and with _SetPixelDensity(2.0f) will set _FringeScale to 0.5f.
You may copy value from any drawlist in the same viewport.
It's not even easy to notice: this was broken on Mac until this week, FringeScale was always set to 1.0 as a result the AA fringe was thicker than necessary, making things a little bit more blurry on retina.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prio:high High priority status:review The task is under review type:fix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants