Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Checking monitor's refresh rate  (Read 1411 times)

0 Members and 1 Guest are viewing this topic.

Brokkoli075

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Checking monitor's refresh rate
« on: January 04, 2024, 12:51:56 am »
Hey Guys,

I'm working on the development of a 3D printer. I need to send a white and black screen to a light engine at a speed approaching the frame rate. Since the monitor is operating at 30 Hz (according to windows settings) the maximum speed at which i can alternate between light and dark screens is 33.33 ms, right? I am currently sending pictures at these intervals meaning 33.33 ms bright screen then a 100 ms of dark screen. I measured the results with the iphone slow motion camera. Firstly, I am having a lot of outliers piling up in between around 66 ms. This would mean that my final 3D prints are faulty. Secondly, the dark time averages out at around 80 ms not 100 ms. Is there anyway I can check the actual light engine (monitor's) frame rate dynamically? It's a simple hdmi connection. Is there anything I'm misunderstanding about how my code, the monitor and the GPU interact?

kojack

  • Sr. Member
  • ****
  • Posts: 343
  • C++/C# game dev teacher.
    • View Profile
Re: Checking monitor's refresh rate
« Reply #1 on: January 04, 2024, 04:46:41 am »
It depends on how you are doing the timing.
If you have vsync on and display each frame before the vsync happens on the monitor, then it should be ok.
Having 66ms sounds like you have vsync on but didn't display frames in time.
For example if you did a timer and tried to display the frame after 33.33ms but also have vsync on, you might be a fraction of a second out of sync and the vsync will be missed, so it has to wait for the next one (giving you 15fps).

Brokkoli075

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: Checking monitor's refresh rate
« Reply #2 on: January 04, 2024, 07:50:10 am »
Thank you for your answer!

I actually tried it with vsync both enabled and disabled but there are still outliers in any case. Is there any way I can "read out" the clock of the monitor so that I can dynamically adjust my program to its clock?

Otherwise, can I dynamically read out the monitor's frequency somehow. I fear that it's not exactly stable and the functions provided by windows.h only give me full integer values.

PS: I'm using light engine and monitor interchangeably here because the light engine is recognized as a second monitor by the computer.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Checking monitor's refresh rate
« Reply #3 on: January 04, 2024, 11:00:03 am »
SFML doesn't support anything specific in that direction. It just relies on the GPU / GPU driver to do the right thing. In theory if you enable vsync and don't do any other frame rate limiting, but just switch between one and the next frame, it should work, but could still be that the GPU doesn't always operate precisely.

Does the light engine not come with specialized software?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything