Hi Michael,

in osgCompute it is very easy to set up this example. Ok let's go through all 
the steps you have to do:


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


Like Art already said you have to render the scene with a camera. Before that 
you need to attach a osgCuda::Texture2D to it which is nothing more than an 
extended osg::Texture2D. (If you are not familiar with that stuff you can take 
a look at the osgprerender example of OSG.)


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


This is already provided by osgCuda::Textures. You have to call the 
map()-function available for all osgCompute::Buffers (osgCuda::Texture2D is a 
osgCompute::Buffer as well). The map function returns a pointer to the GPU 
memory and hides the memory copy as well as the mapping for you. For all types 
of buffers (e.g. osgCuda::Geometry) this is exactly the function to call in 
order to receive a pointer to the device or host memory. This requires an 
internal memory copy on the GPU and cannot be removed by a zero copy function 
since you want to map texture memory on the GPU.


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


Now you have to call your own kernel module. You can also look at our 
osgTexDemo example.


GMan wrote:
> 
>     6 - copy from result PBO to a texture
>     7 - display the texture
> 


You need to specify an output osgCuda::Texture2D (You can use the same texture 
as for your camera if your algorithm allows this). However, to render the 
result back to your screen you render a screen sized quad with this texture 
attached. For this step see also our osgTexDemo example.

I hope this answers your question.

Best regards,

Jens
-- 
SVT Group

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





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

Reply via email to