Hi Fred,

what bandwidth are you trying to achieve? We've had no issues with updating multiple osg Images from camera input with just a PBO attached as per e.g.:

osg_image_buffer[i]->setPixelBufferObject(new osg::PixelBufferObject(osg_image_buffer[i].get()));

where osg_image_buffer[i] is a ref_ptr to osg::Image.

jp

On 06/12/10 15:16, Fred Smith wrote:
Hi Robert,

Let's leave GPU ->  CPU transfers aside. I don't mind if they are slow.

You usually have to use 2 PBOs.

If I use a single PBO to upload texture data to the GPU, performance will be 
very low.

It seems to me I have two ways to do CPU ->  GPU transfers efficiently.

1) Use 2 differents PBOs. Let glTexImage2D do its job with the first PBO, while 
I'm loading up new data into the second PBO with the CPU.
2) Use 1 PBO and the method below (feedback?)


Code:
// Bind PBO
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);

Label1:

// Request new buffer data (third parameter = NULL)
// This call will return immediately. **The GPU will complete any transfer in 
progress with the previous buffer data**.
// As far as the client side is concerned, the new buffer data is immediately 
available.
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, DATA_SIZE, NULL, 
GL_STREAM_DRAW_ARB);

// Load up new pixels into the same pbo, but into its new buffer data 
(requested above), not the previous one
glMapBuffer // returns immediately, because the GPU isn't doing anything with 
the new buffer
updatePixels
glUnmapBuffer

// Issue asynchronous transfer to texture
glTexImage2D(......, 0);

goto Label1;



This method above which should work (I think!) will most likely not be 
supported by OSG at all. I'll have to do things manually.

However perhaps I can resort to method 1 and do something by fiddling with two 
osg::PixelBufferObject objects, two osg::Image objects, creating as many 
osg::Textures as I want, alternating osg::Texture::setImage(image1) and 
osg::Texture::setImage(image2), to be sure I am doing CPU and GPU work in 
parrallel.

Thanks,
Fred

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34554#34554





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support.

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to