anderson@SECS.ucsc.edu (06/27/91)
Would some kind reader please take the time to help me retain my sanity? I am in the process of porting an MSDOS molecular dynamics animation viewer to the Mac. This program uses offscreen drawing to give smooth animation. I have been able to get good results on the Mac in monochrome by drawing to an offscreen bitmap and then using CopyBits to move it to the window. The problem comes when I try to use color. I have been able to get the drawing to the offscreen bitmap and I can copy it to the screen but I get a terrible flicker. I have used SlotVInstall to try to synch the copybits to the vertical retrace but it didn't cure the problem. I have waded through Inside Macintosh I-V, the Mac Technical Notes, and the Usnet Mac Programmer's Guide and I have run out of ideas on what to try next. HELPPPPPPP!!!!!!!! The size of the bitmap may be a contributing factor. I am using the full screen for the drawings so my first question is whether or not it is possible to do the copybits fast enough on this large a bitmap? The program is written in C (about 125K of source code). Originally written with Turbo C++ 1.0 for MSDOS, porting to the Mac using Think C 4.0. Using a Mac IIx for the port to Mac. While I am reasonably experienced with C, this is my first attempt at writing a program for the Mac so please show some mercy if I have overlooked an obvious answer. Sample source code in any language would help but C would be most useful. Gary D. Anderson Department of Chemistry University of California Santa Cruz, CA 95060 anderson@secs.ucsc.edu
smoke@well.sf.ca.us (Nicholas Jackiw) (06/28/91)
In article <17477@darkstar.ucsc.edu> anderson@SECS.ucsc.edu writes: [minor epic of woe about CopyBits flicker deleted] > >The size of the bitmap may be a contributing factor. I am using the full >screen for the drawings so my first question is whether or not it is possible >to do the copybits fast enough on this large a bitmap? > >Gary D. Anderson Is your offscreen bitmap at the same pixel depth as your color monitor? If not, you might want to try determining the pixel depth of the screen on which your drawing window appears (via the Device Manager), and then allocating your offscreen image as a *pixMap*, not a bitMap, at that depth. This saves CopyBits from having to resize each pixel dynamically when moving them to the screen. You can test if this is the problem by setting your monitor to black&white before testing your app (assuming that your offscreen bitmap is a bitmap, i. e. is black and white). If the flicker disappears, that's your problem. Some CopyBits calls can take seconds to complete, even when copying a relatively small picture. You'll see the image rippling during these cases. If you don't give it too much work, though, it performs quite well; I routinely do full-window animation with CopyBits (between bitmaps of the same depth and bit-alignment), and never worry about flicker, or tying my job to a vertical interrupt, etc. -- --- * --- Nick Jackiw Smoke@well.sf.ca.us | Jackiw@cs.swarthmore.edu Key Curriculum Press, Inc. Applelink:KEY.EDUSOFT | (415) 548-2304 --- * ---