1
$\begingroup$

If you clear the color buffer and draw a triangle, you have nothing in the buffer that is shown in the screen and a triangle in the other buffer, so you have to swap buffers for showing the triangle. If you swap buffers, you have a triangle in your screen and a empty color buffer in the other side. If you swap buffers again you should see and empty screen because you changed the buffer with the triangle by the other empty buffer. Instead of this, the triangle is shown again. Why?

$\endgroup$
4
$\begingroup$

If you swap buffers, you have a triangle in your screen and a empty color buffer in the other side.

No, you do not. Buffer swapping does not necessarily mean that the current contents of the front buffer are preserved. When you do a swap, the contents of the back buffer become the front buffer, but the state of the back buffer is undefined after the swap.

Some implementations use a true swap, where the two buffers really are switched. Other implementations copy the data from the back buffer on a swap, leaving the back buffer as whatever was there before. Still others could do something else.

$\endgroup$
  • 1
    $\begingroup$ You are awesome! you always answer all my questions! Thanks a lot! PS: You have to make an opengl tutorial. $\endgroup$ – 4dr14n31t0r Th3 G4m3r Mar 19 '17 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.