Archived

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

m_red

DD Back Buffer

Recommended Posts

Hello, I''m making a program using direct draw. In the program I bltfast a surface to the back buffer, flip, etc. My problem is that after I flip the image is still on the back buffer (it seems), so if I blt it, flip, and blt to a new possistion, instead of being one image (and having it move) there are two. I''m just doing basic stuff, like bltfast and flip. Is my code skrewed up or do I need to clear the buffer?

Share this post


Link to post
Share on other sites
clear that back buffer!
unless the ''blur'' effect is what you''re looking for you should be doing the following.


while(GameIsRunning)
clearBackBuffer();
Draw();
Flip();


~Rob

Share this post


Link to post
Share on other sites
Ok, thanks.

I would have thought the tutorial I''m using would have told me that, it seems pretty necessary.

Share this post


Link to post
Share on other sites
You might try something like this, using the blitter to fill the screen with black. This is 8-bit code though.


void Surface::Fill (int nColor)
{
DDBLTFX ddbltfx;
DX_INIT_STRUCT (ddbltfx);
ddbltfx.dwFillColor = nColor;
lpSurface->Blt (NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
}

surface.Fill (0);

Jesus Saves

Share this post


Link to post
Share on other sites