Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions guide/src/dear_imgui/imgui_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();

Expand Down