-
Notifications
You must be signed in to change notification settings - Fork 47
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
ImFontAtlas::TexID remains unset after a call to ImGuiIntegration::Context::relayout #60
Comments
I'll submit a pull request I'll also add a function to |
I should explain what I'm doing too, probably helpful (maybe good for documentation?). Big picture I'm trying to use color emojis, and do it seamlessly. I should be able to put an emoji in a raw string literal and pass it to ImGui::Text() and it renders a color emoji. I'm very close.
Preferably the latter, because this library makes GL texture stuff not painful! |
The first option is not possible becuase |
Hi again! Apologies if I'm misunderstanding what you want to do (not using ImGui that much myself, definitely not on the advanced level you're on, haha) -- so you are able to add extraneous glyphs together with their position in the atlas to ImGui, but it doesn't let you upload the data for it, and thus you need to do that manually by accessing the texture after, right? Adding a magnum-integration/src/Magnum/ImGuiIntegration/Context.cpp Lines 301 to 302 in 43e86c2
did you try calling
Definitely! If you open a PR, would be great to expand the Context docs with this -- useful for lots of other users :) Thanks in advance. (Please note I'm going to be without an access to a computer for the whole next week, so won't be able to do any merging or reviewing until I get back.) |
Howdy, Yes, https://github.com/ocornut/imgui/blob/ebe79bbed00a13fd4455f04131b63d49c28ebd5d/imgui.cpp#L230-L234 I agree that splitting relayout would be weird, but what about optionally delaying repopulating the GPU texture until newframe? Im not sure. This isn't the issue i'm trying to solve, i'm just spitballing. Cool! I'll try to write a snippet or two. |
Fixed by #61, thank you! |
ImGuiIntegration::Context::relayout()
creates theGL::Texture2D
for the font atlas, but does not set theTexID
in theImFontAtlas
object.I may have just missed something, but I couldn't find any way to access the imgui font atlas texture.
Simple fix tho!
magnum-integration/src/Magnum/ImGuiIntegration/Context.cpp
Line 228 in 43e86c2
Around there this line should fix it:
io.Fonts->SetTexID(reinterpret_cast<ImTextureID>(&_texture));
or
io.Fonts->SetTexID(&_texture);
I am unsure if the reinterpret cast is needed, I would expect it, because
ImTextureID
is void*.It seems like
static_cast<ImTextureID>()
is used elsewhere, so idk.The text was updated successfully, but these errors were encountered: