aclysma / skulpin

Skia + Vulkan = Skulpin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I draw an imgui ImageButton?

ctrlcctrlv opened this issue · comments

With Reclutch I'd just create a glium texture:

https://github.com/mfeq/Qglif/blob/534b6f62e09d89e45ddac96d9f65ac9e2114dfca/src/opengl/imgui/icons.rs#L56

What am I supposed to do with skulpin-imgui-plugin? :-)

Ugh. ImGui doesn't support textures on Vulkan. See ocornut/imgui#914.

I think @ocornut has no plans of supporting them any time soon. That PR has gone unmerged for over four years.

I guess my only hope is FreeType color fonts? Implementing my icons that way per ocornut/imgui#2641 (comment) ? Sigh...every solution, something is always missing. Such is the pain of being a programmer, I guess. Reclutch, no Mac support. Vulkan, no ImGui textures.

@aclysma @jazzfool

Here it is, first build of Qglif using Vulkan.

image

I have to say, I'm a bit disappointed, and building the ImGui font atlas is a bit slow. But, let's not whine, it is working sort of. I will not pout, just contribute how I can. :-)

I had a very hard time building and getting this working and can't push it to my GitHub as-is though @aclysma . Are you available for a Discord chat perhaps? I have a lot of ideas.

commented

I think @ocornut has no plans of supporting them any time soon. That PR has gone unmerged for over four years.

I would VERY much like to solve this but no one was able to give me a thorough and open explanation at the pros and cons of different solutions nor explain me the Vulkan jargon (I don’t even understand what a descriptor is, the many ways people use all this, their lifetime, their validity accross frames etc in various scenarios not just “my engine scenario”). No one seemingly had the patience to help dig and find a solid solution that fits all cases properly, so it is stalling forever despite potentially being a 10 lines patch :(

I do believe a mechanism like ocornut/imgui#2697 may be the key answer to it.

I'm sorry, this is my first Vulkan application @ocornut, so I doubt I can do any better. Sometimes, though, you just have to merge and see what problems users have and go from there. The patch obviously works well for a lot of people. I don't know if this case fits that, but it seems like it does to me.

commented

Conditional compilation might help :-)

Update.

I decided, sadly, for now, that I'm just going to make an icon font. @eliheuer made a nice icon font with different shades of gray, but it's a small price to pay for code sanity. I was throwing in a ton of unsafe's...everywhere, calling on imgui_sys, ImFontAtlas_AddCustomRectFontGlyph, ImFontAtlas_GetCustomRectByAtlas, etc...but it just wasn't worth the headache.

It's working now. I still think it's quite unfortunate I can't get ImGui to draw Vulkan textures, but oh well. :-)

image

See MFEK/glif#3

I'm going to close this as it seems to be more about imgui itself than the code that initializes it