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

2009-03-02 Thread Stephan Posch
Maybe I'm overlooking something simple, but I just don't seem to see it right 
off hand.  I'm using osgPPU to do multiple passes on a scene and I have the 
case where I need the result in two ways (I need both simultaneously):

1)  To the screen (done with UnitOut)
2)  To an osg::Image

Case #1 is obviously simple, but I'm having trouble with case #2.  I've tried 
writing a custom unit similar to that of UnitOutCapture without the save to 
disk, but the call to readImageFromCurrentTexture is extremely slow.  Is there 
a better way to do this?

Thanks,

Steve

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





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


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

2009-03-02 Thread Art Tevs
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





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


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

2009-03-02 Thread Stephan Posch
Thanks Art,

I'll take a look as time allows and see what I can do.

Steve

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





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