View Full Version : refresh rate on LCDs?
kelvin
2004.07.05, 09:45 PM
I'm using the following code to setup refresh-sync'd drawing.NSDictionary *displaymode = (NSDictionary*)CGDisplayCurrentMode (kCGDirectMainDisplay);
float refresh = [[displaymode objectForKey:@"RefreshRate"] floatValue];
if (refresh < 60.0f) refresh = 60.0f;
[NSTimer scheduledTimerWithTimeInterval:1.0f/refresh
target:view
selector:@selector(display)
userInfo:nil
repeats:YES]; Am I correct in assuming 60Hz if I don't have a RefreshRate? Any body know how to get an LCD display refresh rate?
ThemsAllTook
2004.07.06, 12:52 PM
To the best of my knowledge, the refresh rate on LCDs is always 60Hz.
Alex Diener
OneSadCookie
2004.07.06, 08:27 PM
not really, LCDs all have different refresh rates (I've heard as low as 45Hz and as high as 72Hz, but I'd expect that range is constantly increasting).
What LCDs don't have is a vertical refresh... all the pixels are always on, and the image is refreshed essentially instantaneously from a snapshot of VRAM. I don't think this prevents tearing though.
So basically what I'm saying is, if you're relying on knowing the refresh rate of the monitor, you're screwed when it comes to LCDs. My question is, why do you care about the refresh rate of the monitor? Set the swap interval to 1 for your context, and let the OS decide how often you should flip. Just run your loop as fast as possible, and let the blocking in SwapBuffers regulate the frequency of the loop.
kelvin
2004.07.06, 08:48 PM
My question is, why do you care about the refresh rate of the monitor? Set the swap interval to 1 for your context, and let the OS decide how often you should flip. Just run your loop as fast as possible, and let the blocking in SwapBuffers regulate the frequency of the loop. In single threaded apps, blocking kills the UI. I want the option of having Cocoa widgets, and having them responsive.
OneSadCookie
2004.07.06, 10:09 PM
Well, you'll still be responsive at 60+ Hz... is that good enough?
If not, you might want to consider doing your rendering from a second thread.
kelvin
2004.07.07, 02:31 PM
thanks for the feedback. I'll tinker with it.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.