Archived

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

double buffering

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I''m having a little bother with a falling blocks type game. As far as i can tell the main drawing loop should go something like: Erase the old brick position from the back buffer. Draw the brick on the back buffer. flip the primary and back surfaces. increment the position of the brick so it falls down the screen. do it all again. Problem is when i try to erase the old position of the brick, as far as i can tell, it should be on the primary surface. The way the game runs suggests this is so cos erasing it from the back surface has no effect (i end up with alternating squares all down the screen). Is there a standard way of doing this? in the book i have the rendering is always done on the back buffer then flipped at the end of an update screen loop but i dont see how that could ever work.

Share this post


Link to post
Share on other sites
Um, you shouldn''t be "erasing blocks" from the back buffer. Your render function should look like this:

Clear backbuffer
Draw all your bricks
Present (flip if you''re using DirectDraw)

You do this every frame.

neneboricua

Share this post


Link to post
Share on other sites