hello_imgui icon indicating copy to clipboard operation
hello_imgui copied to clipboard

Dynamic FPS

Open ConcurrentState opened this issue 3 years ago • 3 comments
trafficstars

Hello phtom,

thanks for hello imgui.

My project could benefit from having a parameter for FPS. I do not need full FPS all the time. Would be good on accu powered devices or when having other resource hungry apps running, to lower the FPS when not needed. Since imgui has the trickling input queue, this could be possible, I think. What do you think about a parameter for FPS, which the app can set dynamically at runtime?

Best regards

ConcurrentState avatar Jul 28 '22 13:07 ConcurrentState

Hello,

This is a somewhat difficult subject.

HelloImGui can include a specific mode for power save, which will reduce the FPS when not in use. It is based on a PR to imgui https://github.com/ocornut/imgui/pull/4076 that was not accepted in the main ImGui repo. Furthermore, I had to rebase this PR onto the docking branch.

So, this feature is quite advanced, and I cannot guarantee that the API for it will be stable in the HelloImGui repo.

However, if you want to try it, the usage would be:

  1. Clone my fork of imgui that includes this PR, rebased on the docking branch: https://github.com/pthom/imgui/tree/docking_powersave

  2. Tell HelloImGui to use this version of imgui and to use the power save mode:

cmake .. -DHELLOIMGUI_USE_POWERSAVE=IN -DHELLOIMGUI_BUILD_IMGUI=OFF -DHELLOIMGUI_IMGUI_SOURCE_DIR=path/to/imgui/fork 

https://github.com/pthom/hello_imgui/blob/master/CMakeLists.txt#L36

This mode works only with SDL and GLFW.

Best of luck !

pthom avatar Jul 29 '22 14:07 pthom

Note : it is likely that I will work on this subject in the near future in order to build a more consistent API for this.

pthom avatar Jul 30 '22 06:07 pthom

That would be very much appreciated. 👍🏼 This topic is not on top of my prioritylist, but sooner or later I will have to deal with it anyway.

ConcurrentState avatar Jul 30 '22 12:07 ConcurrentState

Hi,

The latest version includes support for FPS throttling.

See https://github.com/pthom/hello_imgui/blob/master/src/hello_imgui/hello_imgui_api.md#runnerparams

pthom avatar Nov 20 '22 14:11 pthom

Hello.

Awesome! Very much appreciated. Will prob. start a development based on this in 01/2023.

Many tanks once again for this project.

Cheers!

ConcurrentState avatar Nov 20 '22 14:11 ConcurrentState