title: OpenGL PBO for texture upload, can't understand one thing
body: <p>Okay , I read everything about PBO here : <a href="http://www.opengl.org/wiki/Pixel_Buffer_Object" rel="nofollow">http://www.opengl.org/wiki/Pixel_Buffer_Object</a>
  and there <a href="http://www.songho.ca/opengl/gl_pbo.html" rel="nofollow">http://www.songho.ca/opengl/gl_pbo.html</a> , but I still have a question and I don't know if I'll get any benefit out of a PBO in my case :</p>
  
  <p>I'm doing video-streaming,currently I have a function copying my data buffers to 3 different textures, and then I'm doing some maths in a fragment shader and I display the texture.</p>
  
  <p>I thought PBO could increase the upload time CPU -> GPU, but here it is, let's say we have this example here taken from the second link above.</p>
  
  <pre><code>glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pboIds[nextIndex]);
  
          // map the buffer object into client's memory
          // Note that glMapBufferARB() causes sync issue.
          // If GPU is working with this buffer, glMapBufferARB() will wait(stall)
          // for GPU to finish its job. To avoid waiting (stall), you can call
          // first glBufferDataARB() with NULL pointer before glMapBufferARB().
          // If you do that, the previous data in PBO will be discarded and
          // glMapBufferARB() returns a new allocated pointer immediately
          // even if GPU is still working with the previous data.
          glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, DATA_SIZE, 0, GL_STREAM_DRAW_ARB);
          GLubyte* ptr = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB);
          if(ptr)
          {
              // update data directly on the mapped buffer
              updatePixels(ptr, DATA_SIZE);
              glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); // release pointer to mapping buffer
          }
  
          // measure the time modifying the mapped buffer
          t1.stop();
          updateTime = t1.getElapsedTimeInMilliSec();
          ///////////////////////////////////////////////////
  
          // it is good idea to release PBOs with ID 0 after use.
          // Once bound with 0, all pixel operations behave normal ways.
          glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
  </code></pre>
  
  <p>Well, whatever is the behavior of the <code>updatePixels</code> function , it is still using CPU cycles to copy the data to the mapped buffer isn't it? </p>
  
  <p>So let's say I wanted to use PBO in such a manner, that is, to update my frame pixels to the PBO in a function , and then in the <code>display</code> function to call glTexSubImage2D (which should return immediately)... Would I see any speed-up in term of performance?
  I can't see why it would be faster... okay we're not waiting anymore during the glTex* call, but we're waiting during the function that uploads the frame to the PBO, aren't we?</p>
  
  <p>Could someone clear that out for me please?</p>
  
  <p>Thanks</p>