Skip to content

Imgui OpenGL3 backend calls ImGui_ImplOpenGL3_CreateFontsTexture only once #6336

@quinor

Description

@quinor

(you may also go to Demo>About Window, and click "Config/Build Information" to obtain a bunch of detailed information that you can paste here)

Version/Branch of Dear ImGui:

Version: v1.89.4
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Operating System: Linux

My Issue/Question:

I'm trying to reload the font while application is running (before calling ImGui::NewFrame() )"

io.Fonts->ClearFonts();
io.Fonts->AddFontFromFileTTF("misc/DejaVuSans.ttf", font_size);

When I try that, the application fails on an assert:

main: /home/quinor/kody/tsparter/build/_deps/imgui-src/imgui.cpp:8976: void ImGui::ErrorCheckNewFrameSanityChecks(): Assertion `g.IO.Fonts->IsBuilt() && "Font Atlas not built! Make sure you called ImGui_ImplXXXX_NewFrame() function for renderer backend, which should call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()"' failed.

What happens is, ImGui_ImplOpenGL3_NewFrame only reloads fonts (ImGui_ImplOpenGL3_CreateFontsTexture) first time NewFrame is called because of logic here

Is this a bug or intended behavior (ie. I'm not supposed to reload fonts while running)?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions