NogginBops / ImGui.NET_OpenTK_Sample

A sample project showing an ImGui (using ImGui.NET) renderer for OpenTK in C#
106 stars 27 forks source link

Imgui viewports #16

Open Pastor111 opened 2 years ago

Pastor111 commented 2 years ago

Does anybody know how to get the imgui viewports working with openTK 4 or 3.3

NogginBops commented 2 years ago

This is something I've been thinking of adding to the sample, it would complicate the sample quite a lot but might be worth spending time doing. It should be possible, but the opening multiple windows part might become quite janky as glfw handles that part in quite a weird way which isn't ideal.

Pastor111 commented 2 years ago

Hi, thanks for the fast reply. I myself have tried to do this task but with not much success. As you mentioned this was because of the windowing system in OpenTK, since when you open another window all the previous windows pause until you focuse them again but then it causes some strange behaviours

Pastor111 commented 2 years ago

But i think it would be good to give it another shoot

NogginBops commented 2 years ago

Hi, thanks for the fast reply. I myself have tried to do this task but with not much success. As you mentioned this was because of the windowing system in OpenTK, since when you open another window all the previous windows pause until you focuse them again but then it causes some strange behaviours

This is likely because you are not handling the redrawing of the other windows. I don't know the details of how you are opening multiple windows, but one thing is that you will not really be able to use the GameWindow.Run loop to update all of the windows. And atm OpenTK might not be properly setup to handle incoming events properly as the event callbacks likely only go to the most recently created window.

All of these are issues that can be worked around, but many of these issues should probably be handled more properly in OpenTK directly.

Pastor111 commented 2 years ago

Yeah that would be the best thing, but can you still try?

NogginBops commented 2 years ago

I can give implementing this a shot, not sure when I'll have time to do this though.

Pastor111 commented 2 years ago

Ok, thank you, i will stay updated

LuisMerinoP commented 2 years ago

what would be the way to achieve this? what would make more sense for me is to be worked on the imgui.net package itself. If not, what I would think of is re-doing the imgui c# bindings from scratch along with the glfw and opengl backends from the c++ updated imgui library with CppSharp or similar, but seems quite an epic feature. When thinking of giving this a shot may I ask if this approach makes sense and if not, roughly which one could @NogginBops? Thanks a lot in advanced

NogginBops commented 2 years ago

Including the backends in the bindings could make sense and has potential to be a lot easier than redoing the backends in c#. I've started a viewports branch here where I have a starting off point for implementing a c# backend for this https://github.com/NogginBops/ImGui.NET_OpenTK_Sample/tree/viewports

Pastor111 commented 2 years ago

Thank you very much, I will try this when I get home however I will need to make it support OpenTK 3.3. But I don't think it would be difficult