jvcleave / ofxImGui

Use ImGui in openFrameworks
292 stars 123 forks source link

handling multiwindow #91

Closed katotetsuro closed 4 years ago

katotetsuro commented 5 years ago

Summary

I modified ImGui's context handling so that I can handle multi window app which has ofxImGui at each windows. In current master, there are several problems at multi window situation.

About test app

I added small app named 'example-multiwindow'.

I think you can check by following steps.

  1. copy example-multiwindow to myApps, then create project file by ProjectGenerator
  2. checkout current master of ofxImGui and problems are shown.
  3. checkout my 'multiwindow' branch and rebuild app, then problems are clear.

Tested env

'example-multiwindow' might be unnecessary for master, I can rebase or remove that before merge.

Thank you for your great addon, any feedback is very welcome.!

moebiussurfing commented 4 years ago

hey @katotetsuro , thanks I am looking to use more than one ofxImGui instance around the classes of my ofApp. Can this branch use the contexts you made to do this? Do you know if it should work with today current master branch/ImGui version?

katotetsuro commented 4 years ago

I didn't test, but theoretically it should work for your case. Because this PR make each ofxImGui instance holds ImGuiContext.

Do you know if it should work with today current master branch/ImGui version?

Sorry, I don't know about it.

katotetsuro commented 4 years ago

BTW, this repository doesn't seem to be active, so I'll close this PR.

moebiussurfing commented 4 years ago

hey @katotetsuro , thanks for your branch and PR! has been very helpful to me.

I tested your branch into my current project and it works! so is up to date enough to make a push...

I tried too with more instances (in other classes) in same window and works fine! When using an instance only or two, do not crash on exit. (your multi window examples crashes here too in macOS)

(@jordiexvision, I see you was looking for this in another issue..)

@jvcleave , this could be maybe a good improvement... not only the multi window support (that crashes) but also the multiple instances too. So we can use ImGui as gui for different classes.

katotetsuro commented 4 years ago

Hi @moebiussurfing , thank you for detailed report. I'm glad to help you!!

If request would come, I'll reopen this PR soon.

moebiussurfing commented 4 years ago

hey @katotetsuro , https://github.com/jvcleave/ofxImGui now has been updated to

latest ImGui: 1.77 WIP. Docking function is available. #104

I still missing the feature of your fork because of that multi-context, that allows me to use many classes with his own independent ImGui.

Do you think it's easy to update? Can you make some tip to do it myself?

Cheers

moebiussurfing commented 4 years ago

hey sorry, I did it myself. I looked at your code it was very simple, just like 4 lines. https://github.com/katotetsuro/ofxImGui/commit/c8e9c8668419c3a191a2442c9eb04593ed832e90 It compiles fine. But it seems my addons are colliding when more than one ImGui is opened. I must check better... Thanks again, it's being helpful here.