
In computer graphics, double buffering is a technique for drawing graphics that shows no (or less) flicker, tearing, and other artifacts.
You can see the code line below in a graphic application using openGL and SDL.
SDL_GL_SwapBuffers();
SDL_GL_SwapBuffers tells SDL to swap the window’s buffers. Possibly you already know what double-buffering is, but some of you probably don’t, so I’m going to explain it anyway. You can imagine double-buffering like this: Suppose you have a piece of paper and you’re drawing on the front. When you’re done drawing, you show the paper to the person in front of you. While the person in front of you is looking at what you drew, you’re drawing on the backside of the paper, once you’re done drawing, you show the back of the paper to the person. Now you clear the front (which is now the back to the person looking at it) and draw something new. This process repeats itself all the time. Basically double-buffering renders everything you want to render on a second buffer (sometimes called the ‘back buffer’). When you’re done rendering, you call SDL_GL_SwapBuffers and the user sees what you rendered. While the user is looking at what you rendered, you’re rendering new things. These new things are rendered on the back buffer again and then swapped to the front. You might wonder what the use is of all this, but double-buffering nowadays is very important. If you don’t do double- buffering, you will have what is called ‘single buffering’; everything you render will replace the existing pixels. So the screen is litterally being overwritten while you’re looking at it, which often results in serious flickering.
(cited in anomtech.uuuq.com)
Related posts: