# GBMVFSA - View Full Screen Animation on OS/2 and eCS

## Introduction

    usage: gbmvfsa [-l] [-p] [-s] [-t] [-P] [-b border] n1 n2 n3 "\"fspec\"{,opt}"
    flags: -l             loop indefinately
           -p             set palette only once, assume same
           -s             single step the frames
           -t             annotate each frame with its title
           -P             display palette bar
           -b border      set border colour index (default 0)
           n1 n2 n3       for ( f=n1; f<n2; f+=n3 )
           fspec            printf(fspec, f);
                          filespecs are of the form fn.ext
                          ext's are used to deduce desired bitmap file formats
                          Bitmap when ext in [BMP VGA BGA RLE DIB RL4 RL8]
                          GIF when ext in [GIF]
                          PCX when ext in [PCX PCC]
                          TIFF when ext in [TIF TIFF]
                          Targa when ext in [TGA VST AFI]
                          ILBM when ext in [IFF LBM]
                          YUV12C when ext in [VID]
                          Greymap when ext in [PGM]
                          Pixmap when ext in [PPM]
                          KIPS when ext in [KPS]
                          IAX when ext in [IAX]
                          XBitmap when ext in [XBM]
                          XPixMap when ext in [XPM]
                          Sprite when ext in [SPR SPRITE]
                          PSEG when ext in [PSE PSEG PSEG38PP PSEG3820]
                          GemRas when ext in [IMG XIMG]
                          Portrait when ext in [CVP]
                          PNG when ext in [PNG]
                          JPEG when ext in [JPG JPEG JPE]
           opt's          bitmap format specific options
       eg: gbmvfsa 0 100 1 frame%03d.bmp

           In case fspec contains a comma or spaces and options
           need to be added, the syntax "\"fspec\"{,opt}" must be
           used to clearly separate the file spec from the options.

This program can be used display an animation consisting of a collection of individual bitmap frames.

It displays the animation to the OS/2 Full Screen 320x200 at 8bpp VGA screen mode. Because of this, GBMVFSA is limited to displaying bitmaps of 320x200 or less, and they must be 8bpp. Also, all the bitmaps must be the same size.

If all the bitmaps share the same palette (presumably enforced by using GBMCPAL) then specify the `-p` option.

If the bitmaps have different palettes then visual artifacts can be produced. This is because for each new frame, the palette is changed, and then the screen bitmap bits are changed. Thus there is a small window in which the old bits are displayed with the new palette. At this time I know of no architected way to synchronise the changes to occur with the vertical retrace, using the OS/2 Vio API.

One way to avoid the problem is to have each bitmap use 128 colours. Even bitmaps would use palette entrys 0 - 127, and palette entries 128 - 255 would contain the previous pictures palette. Similarly in reverse for odd bitmaps.

GBMCPAL (from the base GBM package) provides an attempt at solving the problem. Its `rofreq` and `romcut` options reorder palette entries to try to minimise changes between successive frames. This significantly reduces flicker. In most cases, flicker can be totally eliminated.

The important thing to note is that it is not GBMVFSA's job to solve this problem, it is the job of the bitmap generating program.

For example, here is what I did to make a spinning globe animation. First I traced a largish number of individual bitmap frames using my raytracer, RT. I wrote these out under the names `globeNNN.tif` where `NNN` is `000`, `010`, `020`, ... `350` (ie: the angle of rotation in degrees). I used the `,lzw` option to get the files written LZW encoded to reduce the disk space requirements. Then to map the data to a common palette, I used GBMCPAL :-

      gbmcpal -m freq6:6:6:256 0 360 10 globe%03d.tif globe%03d.bmp

To display the animation under OS/2, using fullscreen VGA, I use :-

      gbmvfsa -l -p 0 360 10 globe%03d.bmp

Obviously there are file formats specifically for holding animations, and algorithms for having animations where palette entries vary from frame to frame, but the simple example above is ok for many purposes.

As the program runs, certain keys can be used :-

      Space     advances a single frame
      -         steps back one frame
      0 .. 9    moves to 0/10 .. 9/10 of the way through
      s         enters single step mode
      g         resumes continuous play
      t         toggles titleing on/off
      p         toggles palette display on/off
      Esc,q,x   quits