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

Getting list of characters rendered in current frame #5295

Closed
invrainbow opened this issue May 7, 2022 · 2 comments
Closed

Getting list of characters rendered in current frame #5295

invrainbow opened this issue May 7, 2022 · 2 comments

Comments

@invrainbow
Copy link

Per #5176, I'm trying to dynamically load new glyphs as needed in order to support arbitrary Unicode input. I was thinking I could:

  1. Draw everything as usual
  2. Right before calling ImGui::Render(), get a list of all characters rendered this frame, and rebuild the atlas
  3. Call ImGui::Render()

Is that possible? If not, I suppose I could wrap every string I send to ImGui in a macro like IMGUI_STR(...) that manually keeps track of the characters. But that would be very tedious.

@rokups
Copy link
Contributor

rokups commented May 9, 2022

It is not practical to implement on-demand glyph loading outside of core library.
There were multiple attempts to implement this already:

None of which are a complete solution. If you decide to salvage that code you are on your own.
If you decide you want to try your own idea, you may modify ImDrawList::AddText() or ImFont::RenderText() to save all rendered characters somewhere and do your thing.

@ocornut
Copy link
Owner

ocornut commented May 13, 2022

Your suggested suggestion wouldn't work anyway, if you rebuild the atlas before Render() all the submitted UV coordinates will be invalidated. One of the key element is #3761 which I would like to focus on soon.

@ocornut ocornut closed this as completed May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants