[osg-users] [osgPPU] Retrieving an Image from osgPPU

Art Tevs osgforum at tevs.eu
Mon Mar 2 11:01:09 PST 2009


Hi Stephan,

there currently no unit exists, which copies the content of the texture into an image in a faster way. However looking on the example of UnitOutCapture is the way to go, as you did.

Currently the implementation of UnitOutCapture does use the simple readImageFromCurrentTexture method as you pointed out. The problem with that method is that it does not run asynchronously and hence stall the CPU. I am not sure, but it also could be that the whenever the data is copied from the GPU memory into the CPU memory it has to get through the CPU which again slow downs the transfer.

What you need is to take a look into PixelBufferObjects (http://www.songho.ca/opengl/gl_pbo.html). These can be used to accelerate transfer of the data from video memory to the system memory by using DMA and asynchronous transfer. In current Unit.cpp (v0.4) from line 580 you can find more how I have used PBOs.
You could even use these PBOs (as used in CUDA example) to read your data into system memory (image). I think this would be the fastest method.
I would be also like to improve the perforamance of UnitOutCapture with this methods as well, however currently I have no time for this.

If you implement this functionality in a new Unit (e.g. UnitOutImage), then I would be happy to include it into the svn trunk. 

Cheers,
art[/url]

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








More information about the osg-users mailing list