realbasic-games
[Top] [All Lists]

Re: Problem SpriteSurface double-buffering

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Problem SpriteSurface double-buffering
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Wed, 29 Jun 2005 10:45:33 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <BAY103-F5D226CA5E4EDFFF61A3A1C1E00 at phx dot gbl>
At 11:17 AM -0400 6/29/05, Ken Gish wrote:

I am trying to get precise control of the duration of Sprites on a SpriteSurface. Duration is the time that two separate 50x50 sprites are visible within a 600x600 spritesurface; smallest duration I need is 1 frame at a 60 Hz frame rate.

You probably can't get that. For this level of control, and for such a simple display, I'd recommend taking control of the display yourself as much as possible -- at a minimum, by using a Canvas.

The built-in double-buffering seems to be doing its job correctly most of the time. Occasionally, a 50x50 sprite - that is displayed for 1 frame - is displayed partially, with uneven brightness, or in some rare instances not at all. It seems that the display is getting updated during the vertical blanking interval which, in turn, means that double-buffering isn't always working or maybe it isn't working at all.

No, it's working fine (the double-buffering is done by the OS itself, and always works). The effect you describe is called "tearing" and it happens when the display is updated during the physical display redraw (and NOT during the vertical blanking interval).

Neither the OS nor REALbasic makes any attempt to sync display updates with the physical display anymore; this is rather hard to do on modern hardware.

Is there any way to read the vertical retrace status bit directly?

Well, yes, in the sense of "anything is possible if you work hard enough at it," but no, in the sense of "probably not practical." Even in classic MacOS, syncing display updates to the vertical refresh required snippets of assembly language and lots of low-level mucking about. On OS X, you have much more varied hardware, a preemptive operating system, and about a zillion more layers of OS between you and the physical screen (or screens).

But, I suppose it's possible that one of those zillion layers of OS has some facility for doing this sort of thing for you. I wouldn't want to discourage you from further investigation. But if it exists, I'm not aware of it.

Best,
- Joe

--
Joe Strout                          REAL Software, Inc.

Vote for REALbasic (twice!) in the LinuxWorld Reader's Choice Awards:
http://linux.sys-con.com/general/readerschoice.htm
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>