-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Description
Version/Branch of Dear ImGui:
Version 1.90.3, Branch: master
Back-ends:
imgui_impl_sdl2.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Windows 10 + Clang-cl 18.1.6
Full config/build information:
No response
Details:
Hello.
I'm using drawlists callbacks the usual(?) way:
if (ImGui::Begin("test", NULL, flags) // flags can make a difference
{
ImDrawList *draw_list { ImGui::GetWindowDrawList() }; // or GetBackgroundDrawList()
draw_list->PushClipRect(position_min, position_max); // or PushClipRectFullScreen();
draw_list->AddDrawCmd();
draw_list->PopClipRect();
TCallbackData *callback_data = new TCallbackData(...);
draw_list->AddCallback(callback_function, callback_data);
draw_list->AddCallback(ImDrawCallback_ResetRenderState, nullptr);
}
ImGui::End();
In callback_function
I juggle textures, bind to units, use glsl programs, the whole zoo is involved.
That's why I add ImDrawCallback_ResetRenderState
.
At first I didn't add AddDrawCmd();
to redraw the rectangle that I will be processing in callback,
but I noticed that I have to do it in more and more cases.
First question: is there any clue about when I should or shouldn't refresh / force redraw this part of image?
Second question is about different draw lists in this context, maybe this will help me understand better the ImGui flow.
If I have a single callback in the frame (or all callbacks are in the same draw lists) skipping redraw (AddDrawCmd
) results in messed up rectangle(s) that was processed in the callback(s). And now the interesting observation which I mention because it was quite hard to debug/trace it: if callbacks are from different draw lists (GetWindowDrawList
/GetBackgroundDrawList
) and one is lacking the redraw, then weird and terrible things are happening. In particular, the fonts looks like someone throw a grenade into textures store (font atlas gets textures from random locations?). The whole ImGui goes loco.
Additionally, changing window properties, like making window invisible (no background, titlebar, borders) causes the mess looks slightly different.
Is there a short explanation for this?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response