|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
Any surface in DirectDraw can be constructed as a flipping surface. A flipping surface is any piece of memory that can be swapped between a front buffer and a back buffer. (This construct is commonly referred to as a flipping chain). Often, the front buffer is the primary surface, but it doesn't have to be.
Typically, when you use the IDirectDrawSurface5::Flipmethod to request a surface flip operation, the pointers to surface memory for the primary surface and back buffers are swapped. Flipping is performed by switching pointers that the display device uses for referencing memory, not by copying surface memory. (The exception to this is when DirectDraw is emulating the flip, in which case it simply copies the surfaces. DirectDraw emulates flip operations if a back buffer cannot fit into display memory or if the hardware doesn't support DirectDraw.) When a flipping chain contains a primary surface and more than one back buffer, the pointers are switched in a circular pattern, as shown in the following illustration.
Other surfaces that are attached to a DirectDraw object, but not part of the flipping chain, are unaffected when the Flipmethod is called.
Remember, DirectDraw flips surfaces by swapping surface memory pointers within DirectDrawSurface objects, not by swapping the objects themselves. This means that, to blit to the back buffer in any type of flipping scheme, you always use the same DirectDrawSurface object the one that was the back buffer when you created the flipping chain. Conversely, you always perform a flip operation by calling the front surface's Flipmethod.
When working with visible surfaces, such as a primary surface flipping chain or a visible overlay surface flipping chain, the Flipmethod is asynchronous unless you include the DDFLIP_WAIT flag. On these visible surfaces, the Flipmethod can return before the actual flip operation occurs in the hardware (because the hardware doesn't flip until the next vertical refresh occurs). While the actual flip operation is pending, the back buffer behind the currently visible surface can't be locked or blitted by calling the IDirectDrawSurface5::Lock, IDirectDrawSurface5::Blt, IDirectDrawSurface5::BltFast, or IDirectDrawSurface5::GetDCmethods. If you attempt to call these methods while a flip operation is pending, they will fail and return DDERR_WASSTILLDRAWING. However, if you are using a triple buffered scheme, the rearmost buffer is still available.
Last updated on Tuesday, May 18, 2004