ImGui.NET icon indicating copy to clipboard operation
ImGui.NET copied to clipboard

Using imgui dll built with "#define ImDrawIdx unsigned int" in imconfig.h makes garbage output

Open alibeirami opened this issue 4 years ago • 4 comments

Hi,

After setting up ImPlot to work with ImGui.Net, I wanted to use "Heatmap" Demo on ImPlot Demo page, but it triggers an assert which says "Too many vertices in ImDrawList using 16-bit indices. Read the comment above" in imgui.cpp. "Comment above" suggests uncommenting "#define ImDrawIdx unsigned int" in imconfig.h file. But doing so makes the output of SampleProgram garbage. I tried to increase the sizeinbytes values of BufferDescription class in CreateDeviceResources function in ImGuiController class with no luck.

Any suggestions? Thanks.

P.S. I checked the C++ version of ImPlot in this Demo which has the same problem. Uncommenting "#define ImDrawIdx unsigned int" solves that. (win32+opengl3 backend)

alibeirami avatar Apr 04 '21 09:04 alibeirami

cimgui should be regenerated first with ImDrawIdx being unsigned int.

After that I am not sure if additional steps in ImGui.NET are needed. (apart from generation)

sonoro1234 avatar Apr 13 '21 18:04 sonoro1234

You have to update the well known types dictionary in TypeInfo.cs

Vectron avatar Apr 14 '21 14:04 Vectron

cimgui should be regenerated first with ImDrawIdx being unsigned int.

After that I am not sure if additional steps in ImGui.NET are needed. (apart from generation)

Thank you. Yes. I think Imgui.Net only needs cimgui.dll. I double-checked and made sure that cimgui.dll and cimplot.dll were generated using "#define ImDrawIdx unsigned int".

You have to update the well known types dictionary in TypeInfo.cs

Thanks. I changed { "ImDrawIdx", "ushort" }, to { "ImDrawIdx", "uint" }, in TypeInfo.cs, Re-Ran CodeGenerator, over-wrote (over-writed?) Generated files back in ImGui.Net "Generated" folder Then Rebuilt SampleProgram.

Still No luck.

im-gar

alibeirami avatar Apr 17 '21 06:04 alibeirami

Similar results here in plain C++ after recompiling with the ImDrawIdx change. image

markisus avatar May 11 '23 01:05 markisus