Copying from one PBO to another

I have two PBOs, which I create with wglCreatePbufferARB and the other appropriate methods.

When rendering my data each cycle, I draw inside the first PBO, after that I want to copy the entire data of the first PBO to the second PBO.

After copying the data to the second PBO, I bind a texture to it and then I draw a textured rectangle with that data.
glBindTexture( GL_TEXTURE_2D, g_dynamicTextureID);
wglBindTexImageARB(pbuffer2.hPBuffer, WGL_FRONT_LEFT_ARB);

My problem is that I do not know how to copy from one PBO to another. I saw the ARB_copy_buffer extension and I am willing to use OpenGL 3.1 but I do not know how to use it in my example.

Can somebody please help me with some code?

Wrong terminology: a pixel buffer (pbuffer) is not a PBO (pixel buffer object).

A PBO is for transfering data back and forth between the RAM and VRAM. A pbuffer is an old fashion offscreen framebuffer.

ARB_copy_buffer is for use with buffer objects (like PBOs), not for pbuffers.

I don’t think it is possible to copy from one pbuffer to another pbuffer.

If you card support it, try to use FBO (framebuffer object) instead of pbuffers. In this case, each colorbuffer can be a texture and this is easy to to reuse a texture or to copy a texture to another texture.