Jump to content
  • Advertisement


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

Red Ant

How do you do double buffering in Windows?

This topic is 6046 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

When I scroll through my windows application, the writing gets kinda f***up. I did an OpenGl console application a while ago ad I seem to recall that the solution to this was double buffering. But how do you do that in Windows?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Turn Auto-Redraw on. This saves the data that is drawn in your window to a "back-buffer" (aka memory) and will redraw it whenever it needs too (like when it scrolls, resizes, etc).


Share this post

Link to post
Share on other sites
The idea of Double buffering is like this...
You draw everything to a offscreen image - could be a DXsurface a array[w][h] or a windows GraphicsDevice.
then you draw this buffer on your screen - this will have the effect of drawing everything simultaneously and you avoid flickering.
(It also has some advantages when it comes to waiting on the vertical retrace on your monitor to avoid ''snow''. ( right-like you''d need that with DX )

It is hard to answer your question without knowing how you draw your graphics... I guess it is WIN32 !?! - then use functions like - (sort of pseudocode) .

HDC memDC = CreateCompatibleDC(...); // backbuffer
Ellipse(memDC, 0, 0, 100, 100); // draw
BitBlt(realDC, ..., memDC ,...); // draw Bbuffer on screen

-! if you need scrolling you can draw on a third bigger buffer and just draw the right part to the backbuffer...

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!