diff --git a/guide/src/dear_imgui/imgui_integration.md b/guide/src/dear_imgui/imgui_integration.md index c7ce6db..b52d402 100644 --- a/guide/src/dear_imgui/imgui_integration.md +++ b/guide/src/dear_imgui/imgui_integration.md @@ -33,9 +33,15 @@ Start a new ImGui frame after resetting the render fence, and show the demo wind m_device->resetFences(*render_sync.drawn); m_imgui->new_frame(); +// ... +render_sync.command_buffer.beginRendering(rendering_info); ImGui::ShowDemoWindow(); +// draw stuff here. +render_sync.command_buffer.endRendering(); ``` +ImGui doesn't draw anything here (the actual draw command requires the Command Buffer), it's just a good customization point to use indirection at later. + We use a separate render pass for Dear ImGui, again for isolation, and to enable us to change the main render pass later, eg by adding a depth buffer attachment (`DearImGui` is setup assuming its render pass will only use a single color attachment). ```cpp diff --git a/src/app.cpp b/src/app.cpp index 98c273d..5aa85b2 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -183,8 +183,6 @@ void App::main_loop() { m_device->resetFences(*render_sync.drawn); m_imgui->new_frame(); - ImGui::ShowDemoWindow(); - auto command_buffer_bi = vk::CommandBufferBeginInfo{}; // this flag means recorded commands will not be reused. command_buffer_bi.setFlags( @@ -222,6 +220,7 @@ void App::main_loop() { .setLayerCount(1); render_sync.command_buffer.beginRendering(rendering_info); + ImGui::ShowDemoWindow(); // draw stuff here. render_sync.command_buffer.endRendering();