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

Inaccurate FPS Counter #97

Open
VisenDev opened this issue Aug 11, 2024 · 3 comments
Open

Inaccurate FPS Counter #97

VisenDev opened this issue Aug 11, 2024 · 3 comments

Comments

@VisenDev
Copy link
Collaborator

When looking at the SDL demo, the FPS number remains static when the window is not receiving any input. I assume that this is because the window is not rendering any frames until it receives input. So the real FPS is 0, but the screen shows something else since no frame has been rendered to update it. (As best I can tell)

I am not sure if I have diagnosed this correctly, but if I have, setting a minimum FPS would be be one way of fixing the inaccurate FPS display. If the FPS never falls below, say, 1 frame a second, the FPS display would always be correct even at low FPS.

Another way of fixing this would be rendering frames after exponentially longer intervals whenever no input it received.

For example, If no input is received, render a frame after 1 second, then after 2, then after 4, then after 8, etc... Thus the FPS display could be updated while the actual FPS is still decreasing.

@david-vanderson
Copy link
Owner

I never thought of having a minimum refresh interval. My initial reaction is that I wouldn't want the app to do anything without getting input - that would be surprising to me. But I understand your desire to not have a very old frame giving a wrong appearance.

If the app was minimized, we wouldn't want it, which would require tracking the minimized state. So it adds some complexity, but also some benefit.

For anybody else reading this, please comment. For an app that only does stuff in reaction to input events (think a photo editor, not a game), would you be surprised if the app had a minimum refresh rate, like 1 FPS?

@VisenDev
Copy link
Collaborator Author

For anybody else reading this, please comment. For an app that only does stuff in reaction to input events (think a photo editor, not a game), would you be surprised if the app had a minimum refresh rate, like 1 FPS?

Such an application would have no reason for doing so, but for the dvui demo trying to demonstrate dvui's low fps event processing abilities - such inaccurate FPS numbers are confusing and obscure what dvui is actually doing.

At the very least, I would like for the demos to have an accurate FPS counter

@david-vanderson
Copy link
Owner

Good point - maybe we put something extra in the examples.

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