turning ImGui C++ demo to C#


photo

Recommended Posts

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

  • Thanks 1
Link to post

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!

  • Like 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to post

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.

 

error.thumb.png.15c64d8753624414e2b91746c18f99ec.png

 

Anybody got the same problem ? I'm running the demo in an empty project with Unigine 2.13 sim on Linux.

 

 

  • Like 1
Link to post

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

  • Like 1
Link to post

@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 ?

  • Like 1
Link to post

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

  • Like 2
  • Thanks 1
Link to post
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.

 

  • Like 1
  • Thanks 1
Link to post