MCPcopy Create free account
hub / github.com/RenderKit/embree / Render

Method Render

tutorials/common/imgui/imgui.cpp:5210–5273  ·  view source on GitHub ↗

Prepare the data for rendering so you can call GetDrawData() (As with anything within the ImGui:: namspace this doesn't touch your GPU or graphics API at all: it is the role of the ImGui_ImplXXXX_RenderDrawData() function provided by the renderer backend)

Source from the content-addressed store, hash-verified

5208// (As with anything within the ImGui:: namspace this doesn't touch your GPU or graphics API at all:
5209// it is the role of the ImGui_ImplXXXX_RenderDrawData() function provided by the renderer backend)
5210void ImGui::Render()
5211{
5212 ImGuiContext& g = *GImGui;
5213 IM_ASSERT(g.Initialized);
5214
5215 if (g.FrameCountEnded != g.FrameCount)
5216 EndFrame();
5217 const bool first_render_of_frame = (g.FrameCountRendered != g.FrameCount);
5218 g.FrameCountRendered = g.FrameCount;
5219 g.IO.MetricsRenderWindows = 0;
5220
5221 CallContextHooks(&g, ImGuiContextHookType_RenderPre);
5222
5223 // Add background ImDrawList (for each active viewport)
5224 for (int n = 0; n != g.Viewports.Size; n++)
5225 {
5226 ImGuiViewportP* viewport = g.Viewports[n];
5227 viewport->DrawDataBuilder.Clear();
5228 if (viewport->DrawLists[0] != NULL)
5229 AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport));
5230 }
5231
5232 // Draw modal/window whitening backgrounds
5233 if (first_render_of_frame)
5234 RenderDimmedBackgrounds();
5235
5236 // Add ImDrawList to render
5237 ImGuiWindow* windows_to_render_top_most[2];
5238 windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindow : NULL;
5239 windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingListWindow : NULL);
5240 for (int n = 0; n != g.Windows.Size; n++)
5241 {
5242 ImGuiWindow* window = g.Windows[n];
5243 IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
5244 if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_top_most[0] && window != windows_to_render_top_most[1])
5245 AddRootWindowToDrawData(window);
5246 }
5247 for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_top_most); n++)
5248 if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window
5249 AddRootWindowToDrawData(windows_to_render_top_most[n]);
5250
5251 // Draw software mouse cursor if requested by io.MouseDrawCursor flag
5252 if (g.IO.MouseDrawCursor && first_render_of_frame && g.MouseCursor != ImGuiMouseCursor_None)
5253 RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));
5254
5255 // Setup ImDrawData structures for end-user
5256 g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = 0;
5257 for (int n = 0; n < g.Viewports.Size; n++)
5258 {
5259 ImGuiViewportP* viewport = g.Viewports[n];
5260 viewport->DrawDataBuilder.FlattenIntoSingleLayer();
5261
5262 // Add foreground ImDrawList (for each active viewport)
5263 if (viewport->DrawLists[1] != NULL)
5264 AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport));
5265
5266 SetupViewportDrawData(viewport, &viewport->DrawDataBuilder.Layers[0]);
5267 ImDrawData* draw_data = &viewport->DrawDataP;

Callers

nothing calls this directly

Calls 7

AddDrawListToDrawDataFunction · 0.85
IsWindowActiveAndVisibleFunction · 0.85
AddRootWindowToDrawDataFunction · 0.85
GetForegroundDrawListFunction · 0.85
SetupViewportDrawDataFunction · 0.85
ClearMethod · 0.45

Tested by

no test coverage detected