Platform SDK: DirectX

Step 4: Update the Display with Page Flipping

[C++]

This section pertains only to application development in Visual Basic. See DirectDraw C/C++ Tutorials.

[Visual Basic]

This step is very similar to the Step 3: Blit to the Primary Surface step in Tutorial 2. In fact, the results are identical, except that this tutorial is done in full-screen. However, since we created the back buffer as part of a flipping chain, instead of constantly re-blitting the entire back buffer to the primary surface we can use page flipping.

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.

This application writes to the back buffer, then flips the primary surface so that the back buffer appears on screen. While the system is displaying the image, we are again writing to the back buffer. The process continues as long as the application is running, allowing us to animate images quickly and efficiently.

After blitting the background image and the sprite to the back buffer, we can flip the surface by calling the DirectDrawSurface7.Flip method as seen in the code:

primary.Flip Nothing, DDFLIP_WAIT