MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / Render

Method Render

extern/imgui/imgui.cpp:5526–5589  ·  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

5524// (As with anything within the ImGui:: namspace this doesn't touch your GPU or graphics API at all:
5525// it is the role of the ImGui_ImplXXXX_RenderDrawData() function provided by the renderer backend)
5526void ImGui::Render()
5527{
5528 ImGuiContext& g = *GImGui;
5529 IM_ASSERT(g.Initialized);
5530
5531 if (g.FrameCountEnded != g.FrameCount)
5532 EndFrame();
5533 const bool first_render_of_frame = (g.FrameCountRendered != g.FrameCount);
5534 g.FrameCountRendered = g.FrameCount;
5535 g.IO.MetricsRenderWindows = 0;
5536
5537 CallContextHooks(&g, ImGuiContextHookType_RenderPre);
5538
5539 // Add background ImDrawList (for each active viewport)
5540 for (int n = 0; n != g.Viewports.Size; n++)
5541 {
5542 ImGuiViewportP* viewport = g.Viewports[n];
5543 viewport->DrawDataBuilder.Clear();
5544 if (viewport->DrawLists[0] != NULL)
5545 AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetBackgroundDrawList(viewport));
5546 }
5547
5548 // Add ImDrawList to render
5549 ImGuiWindow* windows_to_render_top_most[2];
5550 windows_to_render_top_most[0] = (g.NavWindowingTarget && !(g.NavWindowingTarget->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus)) ? g.NavWindowingTarget->RootWindowDockTree : NULL;
5551 windows_to_render_top_most[1] = (g.NavWindowingTarget ? g.NavWindowingListWindow : NULL);
5552 for (int n = 0; n != g.Windows.Size; n++)
5553 {
5554 ImGuiWindow* window = g.Windows[n];
5555 IM_MSVC_WARNING_SUPPRESS(6011); // Static Analysis false positive "warning C6011: Dereferencing NULL pointer 'window'"
5556 if (IsWindowActiveAndVisible(window) && (window->Flags & ImGuiWindowFlags_ChildWindow) == 0 && window != windows_to_render_top_most[0] && window != windows_to_render_top_most[1])
5557 AddRootWindowToDrawData(window);
5558 }
5559 for (int n = 0; n < IM_ARRAYSIZE(windows_to_render_top_most); n++)
5560 if (windows_to_render_top_most[n] && IsWindowActiveAndVisible(windows_to_render_top_most[n])) // NavWindowingTarget is always temporarily displayed as the top-most window
5561 AddRootWindowToDrawData(windows_to_render_top_most[n]);
5562
5563 // Draw modal/window whitening backgrounds
5564 if (first_render_of_frame)
5565 RenderDimmedBackgrounds();
5566
5567 // Draw software mouse cursor if requested by io.MouseDrawCursor flag
5568 if (g.IO.MouseDrawCursor && first_render_of_frame && g.MouseCursor != ImGuiMouseCursor_None)
5569 RenderMouseCursor(g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));
5570
5571 // Setup ImDrawData structures for end-user
5572 g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = 0;
5573 for (int n = 0; n < g.Viewports.Size; n++)
5574 {
5575 ImGuiViewportP* viewport = g.Viewports[n];
5576 viewport->DrawDataBuilder.FlattenIntoSingleLayer();
5577
5578 // Add foreground ImDrawList (for each active viewport)
5579 if (viewport->DrawLists[1] != NULL)
5580 AddDrawListToDrawData(&viewport->DrawDataBuilder.Layers[0], GetForegroundDrawList(viewport));
5581
5582 SetupViewportDrawData(viewport, &viewport->DrawDataBuilder.Layers[0]);
5583 ImDrawData* draw_data = viewport->DrawData;

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