pthom / imgui_bundle

Your fast track to powerful GUIs: Dear ImGui Bundle, an extensive toolkit for Python and C++ with immediate mode efficiency.
https://pthom.github.io/imgui_bundle/
MIT License
696 stars 72 forks source link

Make it possible to implement the backend in python (original title: Include Python bindings for `ImDrawData` and `ImDrawList` arrays) #142

Closed tpwrules closed 1 year ago

tpwrules commented 1 year ago

This would be useful for direct Python control of the drawing process, done e.g. here and other program designs which allow full Python control of the rendering process.

For some reason the binding generation for the draw list array is explicitly disabled here and for some other reason the vertex and index lists don't appear.

Is there any reason this couldn't be changed?

pthom commented 1 year ago

Hi

ImVector is a template class, and this requires more work for python bindings. Fortunately, my generator supports templates; but after a first run, I saw that it requires some adaptations. I will study the feasibility.

pthom commented 1 year ago

Hi @tpwrules ,

I added bindings for almost ImVector instances. See https://github.com/pthom/imgui_bundle/commit/2b91325fc651a4c46832b738556a6020420e2ddc and c68585f50b2d52d4ed59b08e3f37481ae63588fb

As a result, it becomes possible to implement the backend in python. See example here (work in progress!), where I implemented a manual rendering in python, using glfw + opengl backend;

This is inspired from pyimgui's bindings bindings. There is still some work to do on this side. I will not have time to study this in the near future. Contributions on this aspect are welcome, if you are willing to.

tpwrules commented 1 year ago

Thanks for the head start. I am not sure if I can contribute back what I will do but hopefully this makes an integration with ModernGL possible. Maybe it will be contributed back to that project, I'm not sure yet.

I'll update if I need anything further.

tpwrules commented 1 year ago

I did get this working, thanks for the fixes.