Archived

This topic is now archived and is closed to further replies.

Clearing a surface in DDraw

This topic is 6659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

If it's a D3D app, you should call clear() using the D3D device. If it's a regular DDraw app, try calling Blt(), specifying color fill and passing in black.

Share on other sites
I am using double buffering (2 attached surfaces then flipping), but every time I flip I need to mannually clear the last image on the surface mannually (by writing each pixel to black). Is there a way to clear the entire screen easily with one command? (Like in the old Basic days with CLS)

-Omalacon

[This message has been edited by Omalacon (edited October 27, 1999).]

Share on other sites
Try this:

code:
    DDBLTFX ddbltfx;    ZeroMemory(&ddbltfx, sizeof(ddbltfx));    ddbltfx.dwSize = sizeof(ddbltfx);    ddbltfx.dwFillColor = 0;    pDDS->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);

where pDDS is a DirectDraw surface. Hope this helps.