Help me get started with transferring textures with buffer objects.

I was looking at a doc from nVidia about how to perform fast transfers of textures to the GPU.

There’s a part in that document that suggests the following:

To download data to the GPU, bind the buffer to the GL_PIXEL_UNPACK_
BUFFER target using glBindBufferARB(). The glTexImage2D()
command will then unpack (read) their data from the buffer object.

But this is a little bit beyond me. Can someone help me through understanding this?

I have to generate a texture object, I assume. And I think I have to generate a buffer object as well. The texture is like metadata about the format of the buffer (I think). The buffer is the actual storage of the pixels (I think).
Then somehow I have to call glBindBuffer with GL_PIXEL_UNPACK_BUFFER.
And it says to use glTexImage2D. So I’m not sure how the data gets where it needs to go. But here’s my guess on how things work. Someone correct me if I’m wrong.

glGenTextures( 1, &myTexture );
glGenBuffers( 1, &myBuffer );
glBindBuffer( GL_PIXEL_UNPACK_BUFFER, myBuffer );
glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, width, height, format, type, 0 );

I think that because there is something bound to GL_PIXEL_UNPACK_BUFFER that glTexSubImage2D gets its data from the buffer instead of from the data pointer argument. (and the data pointer becomes an offset)

But before this happens, I’ll need to get data into the buffer object. How do I get data into the buffer object? and isn’t that just the same problem all over again?

The purpose of Pixel Buffer Objects is not to make image uploading/downloading fast. It’s to make it asynchronous, so that it happens in parallel with your other code.