Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Feature

Intro to SSS

A Gentle Introduction To The SuperSpriteSurface for REALbasic

Issue: 4.4 (March/April 2006)
Author: Thomas Cunningham, mauitom-at-maui.net
Article Length (in bytes): 15,700
Starting Page Number: 30
RBD Number: 4412
Resource File(s):

Download Icon 4412.sit Updated: Sunday, July 16, 2006 at 9:49 AM

Related Web Link(s):

http://www.tinrocket.com/

Known Limitations: None

Excerpt of article text...

SuperSpriteSurface (SSS) is a powerful alternative to the build-in classes for using sprite and sprite animations in your REALbasic applications. The demos that come with SuperSpriteSurface (SSS) are excellent, but may intimidate someone new to programming, so consider this tutorial and associated demo projects as a kinder introduction to SSS.

Platform Supported

As of this writing, the SuperSpriteSurface (SSS) is for the Mac platform only. However, John has a Windows version in the works and should be released by December 2005. I'm using RB 5.5.5 for this project, however, if you are using RB2005, everything should work the same. Just keep in mind, my screenshots will not look like your IDE.

The SuperSpriteSurface class is written by John Balestrieri and is available from John's web site (http://www.tinrocket.com/). It sells for $29.95. A demo version is available for download. And if you end up using these classes, pay the man!

I will assume that you are somewhat familiar with REALbasic (RB), but I do include screenshots to help you.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


List of Errata

From: Dr. Scott Steinman
To: REALbasic Developer Magazine

I have an important tip for users of SuperSpriteSurface that you might want to publish in the next RBD:

I use SuperSpriteSurface for the creation of vision science software. Vision science applications, which make heavy use of animation, require precisely accurate animation frame timing to prevent image shearing and to present stimuli on the screen for exact intervals. On System 9, the Toolbox's VBlank routines could ensure that animation was in sync with the monitor's vertical retrace. OpenGL, which SuperSpriteSurface uses, also provides these capabilities.

However, a design decision was made in writing SuperSpriteSurface to use timer-based frame updates. This improved its applicability for most software, such as games, but limits its usefulness when accurate frame timing is more important.

Fortunately, the solution to the problem is simple, and allows SuperSpriteSurface to be used for research-quality animation. There is a SWAP_INTERVAL flag in OpenGL that allows you to select whether OpenGL updates its frames in sync with the vertical retrace or not. Below is the REALbasic method I wrote to set this flag with SuperSpriteSurface's AGL library interface to openGL:

  Protected Function setSwap( doSwap as Boolean ) As Boolean
   Dim block As MemoryBlock
   Dim swap As Integer
   If doSwap Then
     swap = 1
   Else
     swap = 0
   End If
   block = NewMemoryBlock( 4 )
   block.Long(0) = swap
   Return aglSetInteger( aglGetCurrentContext(), AGL_SWAP_INTERVAL, block )
End Function

-- Scott


 


|

 


Weblog Commenting and Trackback by HaloScan.com