Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I draw an imgui ImageButton? #65

Closed
ctrlcctrlv opened this issue Sep 8, 2020 · 8 comments
Closed

How do I draw an imgui ImageButton? #65

ctrlcctrlv opened this issue Sep 8, 2020 · 8 comments

Comments

@ctrlcctrlv
Copy link

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? :-)

@ctrlcctrlv
Copy link
Author

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.

@ctrlcctrlv
Copy link
Author

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

@ocornut
Copy link

ocornut commented Sep 8, 2020

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.

@ctrlcctrlv
Copy link
Author

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.

@ocornut
Copy link

ocornut commented Sep 8, 2020 via email

@ctrlcctrlv
Copy link
Author

Conditional compilation might help :-)

@ctrlcctrlv
Copy link
Author

ctrlcctrlv commented Sep 8, 2020

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

@aclysma
Copy link
Owner

aclysma commented Sep 8, 2020

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

@aclysma aclysma closed this as completed Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants