Kireita Posted March 6, 2021 Posted March 6, 2021 Hey there, some time ago the devs of unigine gave us a ImGui demo in C++ and i am currently trying to turn it in to C# with the help of a existing c# wrapper of ImGui called mellinoe/ImGui.NET: An ImGui wrapper for .NET. (github.com) i am currently sitting at 34 errors i cannot solve because i don't know how they work in the C++ counterpart. i hope some of you can help me with this. here is my imgui implementation so far: ImGuiImpl.cs AppSystemLogic.cs it is pretty much a carbon copy of the original implementation but in C# i also added the imgui C++ prototype just in case anybody doesn't have it. thanks for your time and i hope somebody can help me with this. imgui_cpp_prototype.zip 1
silent Posted March 9, 2021 Posted March 9, 2021 Kireita Right now we are doing some internal engine API changes, so it would be possible to create such integration sample in C#. I hope that it would be available in API in 2.14 and we can return back to this sample after release. Thanks! 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Coppel.Damien Posted March 9, 2021 Posted March 9, 2021 Hi ! Thanks for providing that C++ Imgui demo, I've been looking for a while to integrate imgui in my unigine projects. When/where did the devs release that demo ? I didn't find anything on the forum last year when I first try to integrate it myself. I'm having problems to make it work tho. the imgui interface is displayed just fine, but the last frame that was rendered before I open any imgui window, just keeps faintly appearing when I move the camera. you can see it quite clearly at the center of this screenshot, this is what the camera rended before I opened the imgui demo window and moved the camera around. Anybody got the same problem ? I'm running the demo in an empty project with Unigine 2.13 sim on Linux. 1
alexander Posted March 16, 2021 Posted March 16, 2021 Hi Coppel.Damien, Add this line: RenderState::setScissorTest(0.0f, 0.0f, 1.0f, 1.0f); in the static void draw_callback() function here: global_vtx_offset += cmd_list->VtxBuffer.Size; global_idx_offset += cmd_list->IdxBuffer.Size; } RenderState::setScissorTest(0.0f, 0.0f, 1.0f, 1.0f); // place it here! } render_target->disable(); imgui_mesh->unbind(); Best regards, Alexander 1
Coppel.Damien Posted March 16, 2021 Posted March 16, 2021 @alexanderThank you very much, this is perfect. Everything is working fine now :) Is there any way to make the implementation work without modifying main.cpp ? Or do you have any hint to make mouse capture work without interfering with the engine cycle ? 1
silent Posted March 17, 2021 Posted March 17, 2021 In 2.13 there is no way to do it, however in the upcoming 2.14 we added couple of new methods into engine API that will allow us to use default main loop. 2 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
alexander Posted March 17, 2021 Posted March 17, 2021 Hi Kireita, I've made a sample of integration of the ImGui to C#.It will work on the release version of SDK 2.14. So, wait for release :) imgui_csharp.zip Best regards, Alexander 2 1
Kireita Posted March 17, 2021 Author Posted March 17, 2021 2 hours ago, alexander said: Hi Kireita, I've made a sample of integration of the ImGui to C#.It will work on the release version of SDK 2.14. So, wait for release :) imgui_csharp.zip 862.5 kB · 0 downloads Best regards, Alexander **Sreams like baby** thank you! this is so awesome, i guess i have to wait until 2.14 is released so i can test it right? i hope my code helped to make this possible i was checking what i was getting wrong and boy... i didn't even get 40% right XD i am so sorry if this costed you guys a lot of time but i thank you for this! sorry for being annoying, i hope i can make some other integrations possible with you guys :D. 1 1
Ugly1-1 Posted August 17, 2021 Posted August 17, 2021 (edited) How can I cast Unigine Image for ImGui.Image(...) ? Edited August 17, 2021 by Ugly1-1
karpych11 Posted August 18, 2021 Posted August 18, 2021 Hello, In this sample engine textures are used for rendering. You need to convert image to texture and then use in ImGui.Image(...). To convert a texture to a pointer, you can use GCHandle. In render callback you need to restore texture from pointer and set to material. Separate materials should be used for different textures. The attachment contains modified files for this sample. Please change path of image in AppSystemLogic to your test image. ImGuiImpl.csAppSystemLogic.cs 2
Ugly1-1 Posted January 6, 2022 Posted January 6, 2022 If anyone needs it, here's the updated .CS for ImGuiImpl.cs for Unigine 2.15. You will also need to take the imgui.basemat (taken from the 2.15 3rd party demo in the browser). ImGuiImpl.cs imgui.basemat 2
Artemopolus Posted January 11, 2023 Posted January 11, 2023 Hello everyone, where can I find ImGui demo with Unigine? I search engine, which can plot some data for science and engineering
silent Posted January 11, 2023 Posted January 11, 2023 Artemopolus These integration samples are available in SDK Browser -> Samples -> 3rd Party -> Dear ImGui. 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts