Hi Michael,


GMan wrote:
> 
>     1 - render the scene to the framebuffer
> 

Setup a camera with FRAME_BUFFER_OBJECT as rendering target. Then use the 
texture you have added to the camera as input into your CUDA environment.


> 
>     2 - copy the image to a PBO (pixel buffer object)
>     3 - map this PBO so that its memory is accessible from CUDA
> 

I am not sure if osgCompute gives you this possibility on the fly, however in 
the osgPPU::Unit::DrawCallback::drawImplementation() method, you can find the 
functions calls to use in osg to map a texture into CUDA space.


> 
>     4 - run CUDA to process the image, writing to memory mapped from a second 
> PBO
> 

It is up to you what you implement here


> 
>     6 - copy from result PBO to a texture
> 

Again you can find in the same method as above the function calls to do this.


> 
>     7 - display the texture
> 

Render a screen sized quad with the resulting texture.


For the mapping step, upto CUDA2.2, I think, mapping of OpenGL texture into 
CUDA space is not fast. Only the newest drivers and CUDA implementation allows 
to do some kind of zero copy to efficiently map textures into cuda space. 
However, you have to take a look into newest cuda to see if it realy works, 
like I said.

Next, I think if you just want to postprocess textures it would be easier for 
you to take a look into osgPPU. It can do exactly the things you want to do 
manually. Even more the newest osgppu version has CUDA support, so you can 
process the textures in CUDA and not only in GLSL. Take a look into CUDA 
examples of osgPPU. 
osgCompute is a good library to do general computations inside of OSG's scene 
graph. So for example you want to process vertices or maybe do some simulation, 
then this is where you require osgCompute. I am not sure how well osgCompute 
provides you with support for simple texture processing. I guess, you can use 
it for this kind of computations, however it could be that you have to take 
care of specifying inputs, outputs, and render the results. 

However, it would be nice to hear from the authors of osgCompute how to solve 
your needs with this library.

cheers,
art

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





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

Reply via email to