Skip to content

Commit

Permalink
[gui] Fix IMGUI when GGUI is running in headless mode (taichi-dev#3357)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmesingFlank authored and sjwsl committed Nov 3, 2021
1 parent 1bd43bc commit be73302
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions taichi/ui/backends/vulkan/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ void Gui::prepare_for_next_frame() {
ImGui_ImplVulkan_NewFrame();
if (app_context_->config.show_window) {
ImGui_ImplGlfw_NewFrame();
} else {
// io.DisplaySize is set during ImGui_ImplGlfw_NewFrame()
// but since we're headless, we do it explicitly here
auto w = app_context_->config.width;
auto h = app_context_->config.height;
ImGuiIO &io = ImGui::GetIO();
io.DisplaySize = ImVec2((float)w, (float)h);
}
ImGui::NewFrame();
is_empty_ = true;
Expand Down

0 comments on commit be73302

Please sign in to comment.