Hi serkan, hi J.P.,

Here is a link to a simple example solving your problem:
http://www.cg.informatik.uni-siegen.de/data/Downloads/svt/osgComputeDemoApp.zip
We render a rotating cow into a texture then run a cuda-kernel and display the 
result in the same scene.

You need to set the usage flags of your render targets to GL_TARGET, e.g. :
Target0->setUsage( osgCompute::GL_TARGET_COMPUTE_SOURCE ). 
With this flag you tell the texture that it is used as a FBO. 
Unfortunately, OpenSceneGraph does not call any function of osg::Texture when 
it renders into a texture. 
In other words something like texture->applyAsFBO() is missing. 
So there is no way to get notified when this happens. 
The only way to deal with this is to copy the texture memory each time a 
mapping function is called (GPU->GPU which is still fast). 
However, for this the user needs to setup the usage flag.

Additionally, with older drivers/CUDA versions (we are not sure about this) you 
have to call MRTTexture->unmap() after your kernel has finished. 
If you do not call unmap(), the MRTTexture is still mapped in the CUDA context 
and OpenGL cannot render into it successfully.

Hopefully this helps,
Jens

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





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

Reply via email to