Skip to content

Commit

Permalink
Merge pull request #61 from dzid26/gpu-usage
Browse files Browse the repository at this point in the history
Reduce GPU usage when idle
  • Loading branch information
klonyyy committed May 6, 2024
2 parents 27c5add + 2e5167e commit 2be5662
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Gui/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ void Gui::mainThread()
return;
glfwMakeContextCurrent(window);
glfwMaximizeWindow(window);
glfwSwapInterval(2);

IMGUI_CHECKVERSION();
ImGui::CreateContext();
Expand Down Expand Up @@ -103,6 +102,11 @@ void Gui::mainThread()
continue;
}

if (glfwGetWindowAttrib(window, GLFW_FOCUSED) || (tracePlotHandler->getViewerState() == PlotHandlerBase::state::RUN) || (plotHandler->getViewerState() == PlotHandlerBase::state::RUN))
glfwSwapInterval(2);
else
glfwSwapInterval(4);

glfwSetWindowTitle(window, (std::string("STMViewer - ") + projectConfigPath).c_str());
glfwPollEvents();
ImGui_ImplOpenGL3_NewFrame();
Expand Down

0 comments on commit 2be5662

Please sign in to comment.