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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - squares

Pages: [1]
1
Window / Get monitor refresh rate (vsync)
« on: March 29, 2013, 06:18:38 pm »
Is it possible to get the monitor's refresh rate? Also, would it be advisable to check the desired framerate with the refresh rate to use vsync if they are the same, but use setFramerateLimit() if not?
As in:

void initWin()
{
  unsigned short vsyncRate = /* get refresh rate */ 60;
  if ((vsyncRate - this->fps < 5) || (this->fps - vsyncRate < 5)) {
    this->win->setVerticalSyncEnabled(true);
  } else {
    this->win->setVerticalSyncEnabled(false);
    this->win->setFramerateLimit(this->fps);
  }
}
 

Pages: [1]
anything