Closed inobelar closed 3 years ago
Maybe using larger ImDrawIdx data type would help. See imconfig.h in imgui sources.
@hinxx Thanks! After un-commenting that line (for making 32-bit type, instead of 16-bit) everything works (both in native
and wasm
).
To be honest, I was very surprised that the indexes are 16-bit by default (I always thought they were 32-bit). Looking at the git-history of this file, I find that this has been introduced since version 1.50!
After careful reading of ImPlot::README.md
, I found the next note (in Special Notes) section, which describes that case (shame on me, I must RTFM first :smile: ):
If you experience data truncation and/or visual glitches, it is HIGHLY recommended that you EITHER:
- Handle the ImGuiBackendFlags_RendererHasVtxOffset flag in your renderer when using 16-bit indices (the official OpenGL3 renderer supports this) and use an ImGui version with patch imgui@f6120f8, OR...
- Enable 32-bit indices by uncommenting #define ImDrawIdx unsigned int in your ImGui imconfig.h file.
@epezent Well ... after all, (as a complete newbie who took the library for the first time in a rush), I still want to suggest the following additions in the README
(styled by "huge bold font" to not miss it):
ImPlot::PlotHeatmap()
may produce too many vertices into ImDrawList
(depending on passed args), which causes assertion failure. For safety, please make it 32-bit, by editing ImGui::imconfig.h
"
Yes we can make this more emphasized in the RRADME. Good idea.
The README has been updated to include a Extremely Important Note header devoted solely to this issue.
I've added a runtime warning to the demo. Hopefully future users will catch this along with the README updates.
@epezent wow, great idea! Thanks
Clicking over "Heatmaps" and "Histograms" collapsible headers in "ImPlot demo" causes the next assertion:
Assertion failed: draw_list->_VtxCurrentIdx < (1 << 16) && "Too many vertices in ImDrawList using 16-bit indices. Read comment above", at: ../third_party/imgui/imgui.cpp,4269,AddDrawListToDrawData
Note 1:
Note 2: Tested in
native
andwasm
imgui, even in latestdocking
branch. So possibly it is not imgui-relevant, but implot-relevant.Note 3: the same assertion in
v0.9
andv0.8
ImPlot versionsNote 4: Assertion even in case of single
ImPlot::ShowDemoWindow();
, without any other ImGui widgets.Note 5: During debugging "Heatmaps", found that everything works until called
2)
and3)
ImPlot::PlotHeatmap()
functions. After commenting them, everything works ok.After un-commenting them, but with lowering
size
constant (1)
) from200
down to75
makes that two (2)
and3)
) heatmaps works too.Since "##Heatmap1" always displayed correctly (but it's size 7x7, which is kinda small), it seems like
ImPlot::PlotHeatmap()
produces too many vertices intoImDrawList
, when passedrows
andcols
values too high.ImGui version:
ImPlot version (currently latest):