Update GL_TEXTURE_BUFFER as PBO for texturing?

I need to create a Texture (like GL_TEXTURE_2D) in which I can glMapBuffer directly to it and not passing by a PBO copy to it.

When I execute…

glBindTexture(tex1);
glBindBuffer(PIXEL_UNPACK);
glMapBufferRange(PIXEL_UNPACK);

…I can upload data to a PBO but this buffer I use is not really the final one, but the Driver/GPU will copy from this PBO to texture later.

I’m interested to “clone” glTexSubImage2D function to update just a single piece of a texture, but I want to do asynchronously using PBOs.
At the moment I upload initial data and I try to update (for example) 3 continuously pixels…

glBindTexture(tex1);
glBindBuffer(UNPACK, pbo1);
glBufferData(UNPACK, offset(0), GL_STREAM_DRAW);
DataPointer = glMapBufferRange(UNPACK, 3*4, GL_MAP_WRITE_BIT);
memcpy(...);
glUnmapBuffer(UNPACK);
glTexSubImage2D(width*height*4, offset(0));

…but in this way I need to re-Map each sub-region (of other 3 pixels) I want to update, and this is not very fast.

So I wish to entirely map texture and move the pointer memcpying all pixels I want…

glBindTexture(tex1);
glBindBuffer(UNPACK, pbo1);
glBufferData(UNPACK, offset(0), GL_STREAM_DRAW);
DataPointer = glMapBufferRange(UNPACK, width*height*4, GL_MAP_WRITE_BIT);
memcpy(...);  //first 3 pixels
DataPointer = DataPointer + 10;
memcpy(...);  //second region
DataPointer = DataPointer + 13;
memcpy();  //third region (and so on....)
glUnmapBuffer(UNPACK);
glTexSubImage2D(width*height*4, offset(0));

…but the “DataPointer” I get is not the REAL texture memory (the correct pixels values) but it’s an “uninitialized” memory with random data, so only pixels updated with memcpy() are correct and the others are wrong with random data.

I supposed to use “glCopyBufferSubData()” to copy (GPU side) from real Texture to PBO and then glMapBuffer() this PBO uploading pixels, but this method needs to continuously copy (even if GPU-to-GPU) of 1900x1200 pixels every few frames to allow CPU to update pixels in a buffer with all corrected pixels, and it is too much useless work…

Can I upload directly to a Texture using GL_TEXTURE_BUFFER (maybe “ping-pong” method, or doubled buffer, for async upload)?
How use this GL_TEXTURE_BUFFER in Fragment shader texturing (atm I use “sampler2D” GLSL variables and “texture2D(sampler2D, texCoord)” function)?

Thanks!

I’ve found the solution after many and many tries!
Yes, it is possibile to entirely glMap() a GL_TEXTURE_BUFFERS and update its bytes directly without the issues which PBO have (mapped memory is not the texture’s memory but just a temp buffer).