Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vertical retrace



> the VBL interrupt is used to eliminate that in games. Technote TN2003:
> moving your code to Carbon says that the Time Manager should be used.

That's about the most useless advice they could give. Time manager can't do
VBL interrupts, it can only give a constant rate, not tied to anything
external like VBL. It's better than nothing, but certainly no replacement
for SlotVBLInstall.

Ian's explanation, on the other hand, is excellent. If at all possible, use
the back buffer's built-in VBL sync. Otherwise (if your code already writes
directly to screen and it's too much work to change), use
CGDisplayBeamPosition(). It won't be perfect, though, because background
processes sometimes take over at the wrong time and mess up your timing, but
if you play nice and give a lot of time to the system, it's usually OK. And
you can raise the priority of your process too if you feel like you're not
being treated right by the kernel. (see a post of some months ago).

Another problem is that on certain ATI video cards (like Rage 128 pro)
there's some sort of buffer that delays writing of pixels so they end up on
screen after the VBL even though you wrote them well before the beam ever
got near that line. I reported it to some guy who makes ATI drivers, he
confirmed the problem and said they'd look into it, but I don't know if it's
been fixed or if it will ever be. A partial solution is drawing a lot of
extra unchanged pixels after the actual drawing to push the preceding pixels
through, but it's not perfect.

Especially due to the last problem, I'm not doing any VBL syncing under OS
X. I just draw like crazy (500 fps) which is a bit stupid (most frames never
make it to the monitor) but at least it's fluent because the difference
between consecutive frames is so small. Anyway, this may not be a solution
depending on the amount of work per frame.
_______________________________________________
mac-games-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac-games-dev
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.