Skip to content

Avoid switching a built legacy font atlas to managed textures - #74

Merged
sammyfreg merged 2 commits into
sammyfreg:devfrom
martinecker:fix/legacy-font-atlas-texture-mode
Sep 5, 2026
Merged

Avoid switching a built legacy font atlas to managed textures#74
sammyfreg merged 2 commits into
sammyfreg:devfrom
martinecker:fix/legacy-font-atlas-texture-mode

Conversation

@martinecker

Copy link
Copy Markdown

When NetImgui connects after a legacy renderer has built the font atlas, keep RendererHasTextures disabled. Dear ImGui does not allow this setting to change after the atlas is built. Continue sending the retained atlas pixels to the server so remote rendering still receives the font texture.

When NetImgui connects after a legacy renderer has built the font atlas, keep RendererHasTextures disabled. Dear ImGui does not allow this setting to change after the atlas is built.
Continue sending the retained atlas pixels to the server so remote rendering still receives the font texture.
@sammyfreg

Copy link
Copy Markdown
Owner

Did you encounter an issue where you have a backend renderer that do not support the new imgui texture updates, and then connected to net imgui after the font was init by your backend, leading to issues?

@martinecker

Copy link
Copy Markdown
Author

Yes, that was exactly it. Our game renderer doesn't yet support the new texture updates (working on fixing that). So it built and uploaded our font atlas before NetImgui connected and then the already-built font atlas was switched to managed textures, which triggered this assertion in imgui_draw.cpp:

    if (atlas->TexIsBuilt && atlas->Builder->PreloadedAllGlyphsRanges)
        IM_ASSERT_USER_ERROR(atlas->RendererHasTextures == false, "Called ImFontAtlas::Build() before ImGuiBackendFlags_RendererHasTextures got set! With new backends: you don't need to call Build().");

@sammyfreg

sammyfreg commented Sep 5, 2026 via email

Copy link
Copy Markdown
Owner

@sammyfreg
sammyfreg changed the base branch from master to dev September 5, 2026 20:00
@sammyfreg
sammyfreg merged commit 7f4e589 into sammyfreg:dev Sep 5, 2026
0 of 2 checks passed
@sammyfreg

Copy link
Copy Markdown
Owner

Decided to keep this change as is (minus the fix to make it work in the dev branch). I was planning to duplicate the font atlas, but it's not worth adding complexity to handle texture support when not supported by native backend.

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

Successfully merging this pull request may close these issues.

2 participants