title: Multisampling with glBlitFramebuffer
body: <p>This is my first attempt to do multisampling (for anti-aliasing) with opengl. Basically, I'm drawing a background to the screen (which should not get anti-aliased) and subsequently I'm drawing the vertices that should be anti-aliased.
  What I've done so far:</p>
  
  <pre><code>//create the framebuffer:
  glGenFramebuffers(1, &amp;fbo);
  glBindFramebuffer(GL_FRAMEBUFFER, fbo);
  
  //Generate color buffer:
  glGenRenderbuffers(1, &amp;cb);
  glBindRenderbuffer(GL_RENDERBUFFER, cb);
  glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_RGBA8, x_size, y_size);
  glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, cb);
  
  //Generate depth buffer:
  glGenRenderbuffers(1, &amp;db);
  glBindRenderbuffer(GL_RENDERBUFFER, db);
  glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT, x_size, y_size);
  glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, db);
  
  ...
  
  glBindFramebuffer(GL_FRAMEBUFFER, 0);
  //draw background ... ...
  
  glBindFramebuffer(GL_FRAMEBUFFER, fbo);
  //draw things that should get anti-aliased ... ...
  
  //finally:
  glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
  glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
  glBlitFramebuffer(0, 0, x_size, y_size, 0, 0, x_size, y_size, GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST);
  </code></pre>
  
  <p>The problem is: when I call glBlitFramebuffer(...) the whole background gets black and I only see the anti-aliased vertices. </p>
  
  <p>Any suggestions?</p>