home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!apple!sansorge.kaleida.com!user
- From: ansorge@kaleida.com (Sean Ansorge)
- Newsgroups: comp.sys.mac.programmer
- Subject: problem with animation program
- Message-ID: <ansorge-181292151451@sansorge.kaleida.com>
- Date: 18 Dec 92 23:51:02 GMT
- Sender: daemon@Apple.COM
- Followup-To: comp.sys.mac.programmer
- Organization: Kaleida Labs, Inc.
- Lines: 37
-
- I'm writing a real-time animation package and am having a problem I can't
- track down. The program consists of your typical event loop plus another
- animation loop, in which sprites are drawn to the screen from an offscreen
- buffer and sounds are played. All objects are allocated before the drawing
- loop is entered, and all objects are pointer-based (Think C "direct").
- There is an instance variable that acts as a flag to tell an object if it's
- active or not, and when I need a new object of a particular type I walk the
- inactive object list and activate one of the needed objects by setting the
- flag.
-
- All well and good, but after this loop has been running for a while, there
- starts to be a quite noticeable pause whenever a deactivated object is
- activated. This only happens after the loop has been going for a while. If
- I exit the loop and return to the main event loop, wait a second, and
- re-enter the animation loop, the problem vanishes and object activation
- becomes instantateous. Another thing that happens when the animation loop
- is paused is a flicker which appears to be some of the drawing calls
- "catching up", but I'm not sure what it is.
-
- I am using GWorlds for the offscreen buffers, and I am locking the pixmaps,
- and am using CopyBits and CopyMask to do the drawing.
-
- Examination of my heap shows that something is indeed moving about, but
- it's nothing I have control over; all my objects are pointer-based and all
- other data I allocate space for is locked down. I wondered if perhaps
- something in the way Think's method-dispatching engine works could be
- causing heap compaction or other memory movement.
-
- All of this happens regardless of wether the sound calls are made (I'm
- using SndPlay, but when sound is off I don't call it).
-
- I'd appreciate any suggestions.
-
- .........................................................................
- Sean Ansorge (415) 966-0865
- Kaleida Labs, Inc. ansorge@kaleida.com
- .........................................................................
-