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:
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);
}
}
{
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);
}
}