title: How to redraw only an invalidated part of OpenGL context? (for 2D GUI rendering)
body: <p>I'm using OpenGL to optimize GUI rendering. When rendering the whole scene it works fine, but that's not optimal, since often only a small part is changed. So I tried this:</p>
  
  <pre><code>    glReadBuffer (GL_FRONT);
      glDrawBuffer (GL_BACK);
      glCopyPixels (0, 0, sz.X, sz.Y, GL_COLOR);
      glFlush();
  </code></pre>
  
  <p>This should copy front buffer to back buffer, so that afterwards I can change just a portion limited using glViewport. Unfortunately when a scene is changed, it looks like the glCopyPixels command is performed after the actual rendering, so that the original content sort of alphablends with the new graphics.</p>
  
  <p>What is wrong? Or is there a better way to do this?
  (for the record, when I do nothing, the front buffer starts blinking with back buffer and stuff like that...)</p>