Shop OBEX P1 Docs P2 Docs Learn Events
VGA / Monitor Flickering — Parallax Forums

VGA / Monitor Flickering

hbk723hbk723 Posts: 2
edited 2006-08-01 18:10 in Propeller 1
I'm pretty new to this, I've been programming for a long time but have very little experience with microcontrollers. I'm trying to modify the vga_512x384_bitmap demo program. It already has a function called "plot" that sets a pixel, I wrote another similar one creatively named "unplot" to turn off a pixel. Both of these are working just fine, but I get a tremendous amount of flicker when trying to animate something across the screen. Is anyone using any kind of double buffering? Or maybe is it possible to hold off on sending updates to the screen until all the data is written?

The "sprite" I'm trying to move is just a 3x3 or 5x5 square. My first thought was to unplot every pixel then plot every pixel in the new location but this looks horrible. Then I went on to unplotting only the pixels that don't need to be plotted and plot only the new pixels. This looks ok if I'm sliding the sprite in only one direction. If I try to move the sprite diagonally, I can't seem to get the flicker close to acceptable.

Also, of all the smileys in the world, how often does one need a smurf one? smurf.gif

Comments

  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-08-01 16:54
    I thought there was a 'sync' type var that indicated the bottom of the scan line, but this might be the vga_hires_text driver, I'm not sure. If not, maybe you can add it.
    Object being is you need to have the 'new' data in place before (not during) a screen draw.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd

    ·
  • hbk723hbk723 Posts: 2
    edited 2006-08-01 17:34
    Thanks for the response! That's definitely in the right direction! It sounds like I can figure out something that will be good enough for what I would like to do. For curiousity and future's sake, is there a better way than:

    repeat
    wait for SyncPtr to be non-zero
    draw
    set SyncPtr to 0

    And just hoping that draw executes fast enough?
  • Mike GreenMike Green Posts: 23,101
    edited 2006-08-01 18:10
    You can divide up the drawing tasks into several short (time-wise) routines, then do only one at a time during the sync time like:
      slice := 0
      repeat
        repeat until SyncPtr <> 0
        SyncPtr := 0
        case slice
          0: drawPart0
          1: drawPart1
          2: drawPart2
        slice := (slice + 1) // 3
    
    
Sign In or Register to comment.