realbasic-games
[Top] [All Lists]

Re: Ticks and VBL

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Ticks and VBL
From: John Balestrieri <mrjohn at tinrocket dot com>
Date: Tue, 19 Jul 2005 16:02:59 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <BAY103-F16BC2D9ECCA98346FDFC56C1D40 at phx dot gbl>

On Jul 19, 2005, at 3:44 PM, Ken Gish wrote:

Sorry my email wasn't clear. I am going to try to clear up what it is I was trying to say and respond to comments so far.

First, I do only use one function in OpenGL (the AGLSetInteger function) plus the SuperSpriteSurface which is synced to VBL if AGLSetInteger is set to sync to VBL. However, the entire SSS drop- in has more capability than I need at the moment. This isn't a big deal in itself (for example, it doesn't increase the file size much at all). The problem I have is mainly with requiring OpenGL to be installed for this method to work. However, based on an earlier response, this appears to not be a major concern because double buffering was supported as far back as OpenGL 1.1 which was the default for a bunch of graphics cards on OS 10.2.8 (thanks for the link). This doesn't necessarily mean we won't encounter problems but it is at least encouraging.

Actually, just using the AGLSetInteger (and AGLGetCurrentContext) calls will not solve the problem. You do need the other functionality SSS is giving you, such as setting up and maintaining the OpenGL context loading your image and feeding them to OpenGL, tracking the position & rotation of your objects, managing frame time and drawing the screen, etc. Knowing a little about how you are using SSS, I think the only part of SSS that you may not be using is the collision system. However, you are using the rest of it, albeit behind the scenes. :)

Sure, you could do all this without SSS, but that would require learning OpenGL.


Second, I was also asking for a point of contact at Apple to suggest changes to the ticks function. It seems like it would be possible and beneficial to synchronize the ticks (which I presume is a function that is based on the operating system) to VBL. If someone at RB can address why this would or would not be a good idea then that might save me the trouble of trying to contact someone at Apple (which I haven't been able to do yet despite several attempts to do so).

Let's say you could sync to the VBL: you get a message the instant of the event. Anything you do in response to that event is after the event, and will have to wait for the next event anyways. So long as you time 1/60 second intervals, and redraw the screen in 1/60 second intervals, your next image will be waiting in the buffer for the next VLB. The video card is syncing to the VBL, using the next image in it's buffer. So, by queueing <1/60 second ahead of time of the next refresh, you are syncing to the VBL. SSS runs on such a double buffered system.

The caveat to this may be phase-drifts between the timers in the CPU and video card, leading to occasional mistiming -- but I'm not familiar with the hardware to say -- I'm only guessing here.


_______________________________________________
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>