moderngl-window icon indicating copy to clipboard operation
moderngl-window copied to clipboard

integration/imgui_bundle.py: adapt to imgui v1.92 API (fix #222)

Open pthom opened this issue 4 months ago • 1 comments

Hi,

This PR updates the ImGui integration in integration/imgui_bundle.py to support the new ImGui v1.92 renderer API and its RendererHasTextures mechanism.

(I am the author of imgui-bundle)

Summary of changes

  • Updated the renderer to honor ImGui v1.92 dynamic texture lifecycle (ImTextureData, want_create, want_update, want_destroy).
  • Added full support for texture creation, updates, and destruction directly from ImGui draw data.
  • Removed legacy font texture management (now handled internally by ImGui).
  • Simplified the design by merging the former BaseOpenGLRenderer and ModernGLRenderer classes into a single, clearer class (ModernGLRenderer).

Notes

  • ModernGLRenderer.shutdown() is currently not invoked automatically (this is not new: it was also the case before this PR). As a consequence, some textures might not be freed. However I do not know enough about moderngl (and as a matter of fact, a call to it might not be needed).

Test I could successfully test this with examples/integration_imgui.py and examples/integration_imgui_image.py

pthom avatar Nov 09 '25 23:11 pthom

FWIW, I've tested these changes on a project locally and it works perfectly!

Hopefully this gets merged soon-ish. Especially since the "breaking" changes in 1.92 seem to make DPI-awareness much easier to deal with.

This comment is not intended to be a flame for the maintainers / creators of mglw (just to be clear, since I know how much work goes into it).

Thank you all for what you do!

nocarryr avatar Dec 12 '25 22:12 nocarryr