Page Flipping and Back Buffering
A version of this page is also available for
4/8/2010
Page flipping is key in multimedia, animation, and game software. Software page flipping is analogous to the way animation can be done with a pad of paper. On each page the artist changes the figure slightly, so that when you flip between sheets rapidly the drawing appears animated.
Page flipping in software is very similar to this process. Initially, you set up a series of DirectDraw surfaces that are designed to flip to the screen the way artist's paper flips to the next page.
The first surface is referred to as the primary surface, and the surfaces behind it are called back buffers. Your application writes to a back buffer, then flips the primary surface so that the back buffer appears on screen.
While the system is displaying the image, your software is again writing to a back buffer. The process continues as long as you are animating, allowing you to animate images quickly and efficiently.
DirectDraw makes it easy for you to set up page flipping schemes, from a relatively simple double-buffered scheme (a primary surface with one back buffer) to more sophisticated schemes that add additional back buffers. For more information see Flipping Surfaces.