Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Timing haywire only on Mac OS 10.6, is vsync a nop?

This thread is locked; no one can reply to it. rss feed Print
Timing haywire only on Mac OS 10.6, is vsync a nop?
jmreiser
Member #12,162
August 2010

I have a small application using Allegro 4.2.3.1 on the Mac, and alleg42.dll on Windows. On most machines everything works the same and works fine. However on a couple of new Macs running Mac OS 10.6, the simple animation graphics we are doing run way too fast. As best I can tell so far it's an issue between Allegro and Mac OS 10.6. Works fine on 10.4 on all sorts of machines. Not an issue on Windows no matter what we do. Anyone heard of this before? Has vsync become a no-op on 10.6?? We use vsync and then blit(). When I comment out the call to vsync(), I get the same behavior on 10.4 and elsewhere. TIA

Evert
Member #794
November 2000
avatar

Not that I know of, but I suppose it's possible.
It may also depend on the type of Mac you're running on (do you have 10.4 and 10.6 running on the same machine?), which I would expect to be more of a factor.

Note that in general you should not rely on vsync to synchronise your logic. This is why.

EDITed unfortunate typo...

Matthew Leverton
Supreme Loser
January 1999
avatar

Don't know about the 10.6 specifics.

But vsync was never meant to be a way to regulate timing. It is a way to prevent sheering on CRTs.

To implement timing, set up an "interrupt" that is called 60 times per second, which in turn updates a global variable. Monitor that variable for increments in your main loop, and act accordingly.

MiquelFire
Member #3,110
January 2003
avatar

Also, vsync may not be at the same speed on all machines. One could be 100 fps, another 59, another 60, another 75, etc.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red
If anyone is of the opinion that there is no systemic racism in America, they're either blind, stupid, or racist too. ~Edgar Reynaldo

jmreiser
Member #12,162
August 2010

Thanks you guys. Very speedy replies too.

I just noticed this in the FAQ (doh!):

Quote:

Q: Why doesn't vsync() seem to work?

A: A number of graphics cards have buggy or incomplete VESA implementations,
and often the vsync() function is not implemented.

The machines that exhibit this behavior are relatively new 15" MacBook Pros running 10.6, so it may be a MacBook Pro issue rather than 10.6 per se.

Evert
Member #794
November 2000
avatar

jmreiser said:

I just noticed this in the FAQ (doh!):

Yeah, well, I guess that particular answer hasn't been particularly relevant for at least 10 years. VESA is an old DOS standard for graphics cards. It has never been relevant for Windows, let alone OS X, ports of Allegro.

It may also be worth pointing out that on an LCD screen, there's no such thing as "vsync". I think A5 will actually report something like 70 fps on my MacBook, which is a lie (the OS call to get the vsync value actually returns 0, meaning "vsync not supported").

jmreiser
Member #12,162
August 2010

Maybe this is more of a documentation issue around vsync().

In the online manual:

Quote:

void vsync();

Waits for a vertical retrace to begin.

Or not!

You guys are right, vsync is not the way to go. We inherited this code (long story). Thankfully we don't have any CRT's left and vsync's behavior in this case is actually reasonable, it's the online manual that needs a fix.

Go to: