mosra / magnum-integration

Integration libraries for the Magnum C++11 graphics engine
https://magnum.graphics/
Other
99 stars 45 forks source link

ImGui integration does not support drawing lots of elements (ImGuiBackendFlags_RendererHasVtxOffset) #82

Closed arximboldi closed 2 years ago

arximboldi commented 3 years ago

Hi!

When drawing meshes with more than 64K elements with ImGui the backend needs to support ImGuiBackendFlags_RendererHasVtxOffset

Looking at it, it should not be very difficult for the Magnum integration to do this. One can check their official OpenGL3 renderer for reference: https://github.com/ocornut/imgui/blob/6a161b878943241ddecbeee4ae27103dbd2d33d0/backends/imgui_impl_opengl3.cpp

Cheers!

mosra commented 3 years ago

Hi,

I was aware of this feature and it was on my TODO list for quite some time, but I treated it more like a perf optimization than a blocker (IIRC it can reduce some work this way), which is why it's not there yet :) Coincidentally, Magnum recently got support for vertex offset for GLES and WebGL (for some reason it's an extreme problem to specify vertex offset on those platforms), so this feature could be added not just for desktop GL.

Unfortunately at this point I'm rather busy with other things so I can't promise any ETA when this gets done.

(Or maybe @Squareys could have an use for this as well? Haha.)

arximboldi commented 3 years ago

No worries! I worked-around this so far by using ImDrawIdx=unsigned int. I agree this can be considered an optimization rather than a bug (it's only mildly annoying because one has to figure out what is going on when one starts experiencing data truncation in ImGui).

In any case, thanks for the super-quick response and all the great work in this library. Magnum is a very well engineered library! :heart:

mosra commented 3 years ago

Ah, if that works that's great.

Btw., can you share what you're using Magnum for? :) I'm wondering what use case involves drawing thousands of GUI elements.

arximboldi commented 3 years ago

Sadly I can't share but I can tell you it's a cool project in the domain of movie-making :)

The ImGui limit was hit though while using this library to plot dense graphs: https://github.com/epezent/implot

Squareys commented 3 years ago

Yeah, this sounds useful! I'm using implot, too, but surprisingly haven't hit the limit yet 🤔 Unfortunately I don't believe I'd get to implementing this too soon either, though.

mosra commented 2 years ago

Fixed with #90.

arximboldi commented 2 years ago

Thank you so much @mosra and @pezcode :clap: