Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame rate control for individual windows #7792

Open
Augenstern-create opened this issue Jul 14, 2024 · 1 comment
Open

Frame rate control for individual windows #7792

Augenstern-create opened this issue Jul 14, 2024 · 1 comment

Comments

@Augenstern-create
Copy link

Version/Branch of Dear ImGui:

Version 1.90.1, Branch: docking

Back-ends:

imgui_impl_win32.cpp + imgui_impl_dx12.cpp

Compiler, OS:

MSVC 2022 + Windows10 x64

Full config/build information:

No response

Details:

My Issue/Question:
I try to create two imgui sub-forms in Windows form ImGui::Begin1 ImGui::Begin2, ImGui::Begin2 Do not need too high frame rate, because it will waste extra resources, I want to control the frame rate of ImGui::Begin2 separately. The first attempt is to use the std::this_thread::sleep_for method to add a suitable delay when drawing, but this method will also affect the frame rate of ImGui::Begin1, and the second attempt is to add the if judgment. When the current frame rate exceeds the preset frame rate, the contents of ImGui::Begin2 will not be drawn, but this method will cause the problem of flickering drawn contents. I want to control the frame rate of ImGui::Begin2 subform separately without affecting the frame rate of ImGui::Begin1. How can I solve this problem?

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();
@ocornut
Copy link
Owner

ocornut commented Jul 15, 2024

Generally the right answer is "find a way to make Begin2 not costly".
It is actually very slow / expensive ? Or you are just doing a theoretical optimization?

There is an undocumented feature SetNextWindowRefreshPolicy() (#3515) in imgui_internal.h, but honestly I am not sure this is a problem you need to solve this way.

@ocornut ocornut changed the title Frame rate control based on individual subforms Frame rate control for individual windows Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants