refresh rate on LCDs?

Member
Posts: 469
Joined: 2002.10
Post: #1
I'm using the following code to setup refresh-sync'd drawing.
Code:
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?

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #2
To the best of my knowledge, the refresh rate on LCDs is always 60Hz.

Alex Diener
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
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.
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #4
OneSadCookie Wrote: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.

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
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.
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #6
thanks for the feedback. I'll tinker with it.

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Separating update rate from render rate Jar445 5 4,115 Jan 17, 2009 01:43 PM
Last Post: AnotherJake
  Resolution, Depth, &amp; Refresh Rate nabobnick 1 2,331 Mar 9, 2005 01:40 PM
Last Post: arekkusu
  variable frame rate animation in Cocoa Damian 3 3,636 Jul 16, 2003 06:00 PM
Last Post: macboy