Jump to content
  • Advertisement


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


double buffering

This topic is 5298 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.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!