title: Reading the pixels values from the Frame Buffer Object (FBO) using Pixel Buffer Object (PBO)
body: <p>Can I use Pixel Buffer Object (PBO) to directly read the pixels values (i.e. using glReadPixels) from the FBO (i.e. while FBO is still attached)?</p>
  
  <p>If yes,</p>
  
  <ol>
  <li>What are the advantages and disadvantages of using PBO with FBO?</li>
  <li>What is the problem with following code</li>
  </ol>
  
  <p>{</p>
  
  <pre><code>//DATA_SIZE = WIDTH * HEIGHT * 3 (BECAUSE I AM USING 3 CHANNELS ONLY)
  // FBO and PBO status is good
  .
  .
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId);
  //Draw the objects
  </code></pre>
  
  <p><strong>Following glReadPixels works fine</strong></p>
  
  <pre><code>glReadPixels(0, 0, screenWidth, screenHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE,  (uchar*)cvimg-&gt;imageData);
  </code></pre>
  
  <p><strong>Following glReadPixels DOES NOT WORK :(</strong></p>
  
  <pre><code>glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboId);
  //yes glWriteBuffer has also same target and I also checked with every possible values
  glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); 
  glReadPixels(0, 0, screenWidth, screenHeight, GL_BGR_EXT, GL_UNSIGNED_BYTE, (uchar*)cvimg-&gt;imageData);
  .
  .
  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); //back to window framebuffer
  </code></pre>