Hexa.NET.ImGui icon indicating copy to clipboard operation
Hexa.NET.ImGui copied to clipboard

ExampleD3D11 and ExampleOpenGL3 projects don't work out-of-the-box on latest

Open Cidolfas opened this issue 7 months ago • 3 comments

I pulled down the latest revision from the repository to take a look at this library and found that the ExampleD3D11 and ExampleOpenGL3 projects won't compile for me unless I roll back to before commit e9db85f

The issue seems to be that the obsolete Renderer.cs code now has an ambiguous implicit conversion problem (from #44) that stops it from working without making code changes first

Specifically, they both have a line like io.Fonts.SetTexID(0); where the compiler can't figure out if the literal 0 is supposed to be a ulong, a nint, or a nuint

It's a trivial fix, but either deleting the now-obselete Renderer.cs file or using 0UL for the literal instead of 0 fix the problem and let it compile

(I get a related warning about public static ImTextureID Null => new ImTextureID(0); having an ambiguous constructor reference, but it compiles fine and also is fixed by using 0UL instead of 0)

I don't know which way you'd want to fix it, so I'm just letting you know

Cidolfas avatar May 11 '25 23:05 Cidolfas

As mentioned earlier, these examples are part of the deprecated C# backends and aren't actively maintained. The current, supported path is via Hexa.NET.ImGui.Backends (for example ExampleSDL3OpenGL or ExampleGLFWD3D11). The compiler issue you described is trivial and expected in the deprecated setup. If you feel it's worth patching, feel free to open a PR otherwise, there’s no need to file issues walking through fixes for code that’s no longer supported. And yes I'm very aware of how to fix it. The deprecated examples are just there for reference when someone wants to make their own backend in a custom environment where you don't have access on the windowing or graphics backends directly like unity or monogame.

JunaMeinhold avatar May 12 '25 05:05 JunaMeinhold

And it's also generally advised to not use the examples in master branch head and always checkout the rolling release git tag, because master can have changes that are not present in rolling releases.

JunaMeinhold avatar May 12 '25 06:05 JunaMeinhold

Apologies if I misunderstood you. I thought you were referring to the renderer class marked as Obsolete in code when talking about the ExampleD3D11 project, not the entire project

I'll submit a PR that will hopefully make it clearer that people should be looking at ExampleGFWLD3D11 as an example instead, so that the next person doesn't get caught up on that

Cidolfas avatar May 13 '25 02:05 Cidolfas