Forum Discussion
bcoding
10 years agoVisitor
"belltown" wrote:
You draw the text on the screen (in the back-buffer), then call SwapBuffers (now the text you drew is in the front-buffer; the back-buffer will have no text). Each time through your main loop you call SwapBuffers. The first call to SwapBuffers in your loop will swap the front and back buffers, so the screen buffer with no text is now in the front-buffer (the text is in the back-buffer) and the text seems to disappear. The next time you call SwapBuffers the text, which was in the back-buffer, is swapped to the front-buffer, and the text re-appears. Etc, etc, etc. One way to fix this is to re-draw the text after the initial SwapBuffers call.
Thank you for the reply. It worked that way however the background color is different between the two buffers. I mean I can again set the screen background color along with text after the initial swappBuffer(). But is it a good programming practice to set everything again.
Also, i noticed that if I use single buffer instead of double buffer, I don't have to deal with these problems. I can set everything once then call finish(). So, what advantage does the double buffer have over single buffer.