vertical retrace interval
Skip this Video
Download Presentation
Vertical Retrace Interval

Loading in 2 Seconds...

play fullscreen
1 / 12

vertical retrace interval - PowerPoint PPT Presentation

  • Uploaded on

Vertical Retrace Interval. An introduction to VGA techniques for smooth graphics animation. The CRT Display. Screen’s image consists of horizontal scanlines, drawn in top-down order, and redrawn about 60-70 times per second (depending on display mode). . Image “persistence”.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'vertical retrace interval' - bernad

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
vertical retrace interval

Vertical Retrace Interval

An introduction to VGA techniques for smooth graphics animation

the crt display
The CRT Display

Screen’s image consists of horizontal scanlines, drawn in top-down order,

and redrawn about 60-70 times per second (depending on display mode).

image persistence
Image “persistence”
  • The impression of a steady screen image is purely a mental illusion of the viewer’s
  • The pixels are drawn on the CRT screen too rapidly for the human eye to follow
  • And the screen phosphor degrades slowly
  • So the brain blends a rapid succession of discrete images into a continuous motion
  • So-called ‘motion pictures’ are based on these phenomena, too (30 frames/second)
color dithering
Color “dithering”
  • The mind’s tendency to “blend” together distinct images that appear near to one another in time can be demonstrated by using two different colors -- alternately displayed in very rapid succession
  • This is called “dithering”
  • Some early graphics applications actually used this technique, to show extra colors
timing mechanism
Timing mechanism
  • Today’s computers can “redraw” screens much faster than a CRT can display them
  • We need to “slow down” the redrawing so that the CRT circuitry will be able keep up
  • Design of VGA hardware allows programs to “synchronize” drawing with CRT refresh
  • Use the “INPUT STATUS REGISTER 1” accessible (read-only) at I/O port 0x3DA
input status register one
Input Status Register One

7 6 5 4 3 2 1 0

Vertical Retrace status

1 = retrace is active

0 = retrace inactive

Display Enabled status

1 = VGA is reading (and displaying) VRAM

0 = Horizontal or Vertical Retrace is active

I/O port-address: 0x3DA (color display) or 0x3BA (monochrome display)

void vsync void
void vsync( void )


// wait for current retrace to finish

while ( ( inb( 0x3DA ) & 8 ) != 8 );

// wait until the next retrace begins

while ( ( inb( 0x3DA ) & 8 ) == 8 );


// This function only returns at the very beginning

// of a new vertical blanking interval, to maximize

// the time for drawing while the screen is blanked

animation algorithm
Animation algorithm
  • Erase the previous screen
  • Draw a new screen-image
  • Get ready to draw another screen
  • But wait for a vertical retrace to begin
  • Then go back to step 1.
how much drawing time
How much drawing time?
  • Screen-refresh occurs 60 times/second
  • So time between refreshes is 1/60 second
  • Vertical blanking takes about 15% of time
  • So “safe” drawing-time for screen-update is about: (1/60)*(15/100) = 1/400 second
  • What if a screen-update takes longer?
  • Animation will exhibit “tearing” of images
programming techniques
Programming techniques
  • Your application may not require that the full screen be redrawn for every frame
  • Maybe only a small region changes, so time to “erase-and-redraw” it is reduced
  • You may be able to speed up the drawing operations, by “optimizing” your code
  • Using assembly language can often help
using off screen vram
Using off-screen VRAM
  • You can also draw to off-screen memory, which won’t affect what’s seen on-screen
  • When your ‘off-screen’ image is finished, you can quickly copy it to the on-screen memory area (called a ‘BitBlit’ operation)
  • Both CPU and SVGA provide support for very rapid copying of large memory areas
our animate1 cpp demo
Our ‘animate1.cpp’ demo
  • We can demonstrate smooth animation with a “proof-of-concept” prototype
  • It’s based on the classic “pong” game
  • A moving ball bounces against a wall
  • The user is able to move a “paddle” by using an input-device (such as a mouse, keyboard, or joystick)
  • We didn’t implement user-interaction yet