realbasic-games
[Top] [All Lists]

Re: exact number of refreshes

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: exact number of refreshes
From: Frank Condello <developer at chaoticbox dot com>
Date: Fri, 30 Sep 2005 00:54:04 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <20050929121704 dot 27817 at pshome dot bangor dot ac dot uk>
On 29-Sep-05, at 8:17 AM, Robert Ward wrote:

Assuming your framerate is always maxed out to the refresh rate you
should be able to just call aglSwapBuffers multiple times for each image.
Each buffer swap will block until the next refresh when VBL sync is
enabled, so just swap buffers twice for image1 and swap three times for
image2...

Thanks, that sounds great. Can I just clarify a bit?

According to Apple, aglSwapBuffers swaps the 'front' and 'back' buffers. The front buffer is presumably what's being displayed, but I'm wondering
what I do to set the back buffer to the same image?

Typically when you're using a double buffered context, OpenGL will be drawing on the back buffer. You only see an image when you "swap" the back buffer to the front. Swap is a poor description though, you're actually just replacing the front buffer with the image on the back buffer, and the back buffer remains as-is. So "swapping" twice just copies the same back buffer image to the front buffer twice - no need to re-render the scene if it hasn't changed.

Are you suggesting a solution something like:

for i = 0 to UBound(images_to_present)
    obj3d.shape = i
    rb3dspace1.update
    for j = 1 to REFRESHES_TO_PRESENT
        aglSwapBuffers(aglGetCurrentContext())
    next
next

I was assuming you were talking to OpenGL/AGL directly rather than going through Rb3D, but this *should* work. The fact that you have no control over what goes on inside rb3dspace1.update should scare you just a little bit though ;)

Frank.
–––––––––––––––––––––––––––––––––
Open Source RB Goodies and Shareware
<http://developer.chaoticbox.com/>
<http://www.chaoticbox.com/>
–––––––––––––––––––––––––––––––––

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