Reduce viewer frame rate when it doesn't have focus.

This commit is contained in:
Bartosz Taudul 2018-07-29 22:11:24 +02:00
parent 672925ac04
commit 43255b01fa

View File

@ -252,6 +252,11 @@ int main( int argc, char** argv )
ImGui::Render();
ImGui_ImplGlfwGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
if( !glfwGetWindowAttrib( window, GLFW_FOCUSED ) )
{
std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
}
}
// Cleanup