Secondary
Surfaces (backbuffer)
for
animation:
· create complex primary surface
o add DDSD_BACKBUFFERCOUNT
to the ddsd.dwFlags field to indicate that the dwBackBufferCount
field of the DDSURFACEDESC2 structure is valid (ie:
1)
o add DDSCAPS_COMPLEX
| DDSCAPS_FLIP to the capabilities of the DDSURFACEDESC2
·
create
secondary GetAttachedSurface(<ddscaps>,<backSurfPtr>)
· draw on secondary while primary is
displayed
· flip surfaces
o clear back buffer
o render the scene
o flip with next attached surface
while( lpddsprimary->Flip(NULL,
DDFLIP_WAIT)
!=DD_OK);
// keep trying till you flip it
Flip( lpDDSurfaceOverride,
// change flip order – use NULL
dwFlags);
both the
back & primary buffer must be locked to do the page flip