Hi Robert, 

here is a submission of an additional class of PixelBufferObejct, which 
implements more general way of handling with PBOs. Current osg implementation 
of PBO does use an attached osg::Image to copy data from. This is somehow only 
one way of using it and doesn't provide full functionality of PBOs.

--------------------------------------------
Descripton:

The patch does provide a new class PixelDataBufferObject which is capable of 
allocating memory on the GPU side (PBO memory) of arbitrary size. The memory 
can then further be used to be enabled into read mode 
(GL_PIXEL_UNPACK_BUFFER_ARB) or in write mode (GL_PIXEL_PACK_BUFFER_ARB). 
Enabling the buffer into write mode will force the driver to write data from 
bounded textures into that buffer (i.e. glGetTexImage). Using buffer in read 
mode give you the possibility to read data from the buffer into a texture with 
e.g. glTexSubImage or other instuctions. Hence no data is copied over the CPU 
(host memory), all the operations are done in the GPU memory.


--------------------------------------------
Compatibility:

The new class require the unbindBuffer method from the base class BufferObject 
to be virtual, which shouldn't break any functionality of already existing 
classes. Except of this the new class is fully orthogonal to existing one, 
hence can be safely added into already existing osg system.

--------------------------------------------
Testing:

The new class was tested in the current svn version of osgPPU. I am using the 
new class to copy data from textures into the PBO and hence provide them to 
CUDA kernels. Also reading the results back from CUDA is implemented using the 
provided patch. The given patch gives a possibility of easy interoperability 
between CUDA and osg (osgPPU ;) )


--------------------------------------------
I think in general it is a better way to derive the PixelBufferObject class 
from PixelDataBufferObject, since the second one is a generalization of the 
first one. However this could break the current functionality, hence I haven't 
implemented it in such a way. However I would push that on a stack of wished 
osg 3.x features, since this will reflect the OpenGL PBO functionality through 
the classes better.

 
Best regards,
Art



      

Attachment: PixelDataBufferObject.tar.gz
Description: GNU Zip compressed data

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to