[osg-users] [osgCompute] Persistant texture modification using osgCompute / CUDA

Asmar Arsala asmararsala at hotmail.com
Wed Nov 4 04:05:11 PST 2009


Dear all,
 
I’m interested to see whether I can use osgCompute for my project’s goal, which is real-time height-map deformation system. For starters, I’m trying to let an osgCompute node modify a 2D OSG float texture (the height-map) each frame, using a CUDA kernel. 
My problem now is that I can’t get osgCompute to make persistent changes to the source texture, it seems that either the CUDA kernel changes the texture only once or that it performs the same changes each frame to the original texture data. Any advice or hints on how to set up my buffers, textures and arrays in osgCompute to achieve persistent changes would be greatly appreciated.
I’m using osgCompute 0.4 (with CUDA 2.3, OSG 2.8.2, VS 9.0 / WinXP) and I started off with modifying the provided osgTexDemo example:
 
With regard to the original source code I changed the SrceBuffer and TempBuffer to single dimension (linear) osg::Cuda::Arrays with the intent to alternatingly read from, and write to, these respectively.
The extended (overloaded) osgCompute::Module::launch() alternatingly maps the SrceBuffer and TempBuffer as the source and target for the primary Cuda kernel respectively.
The setImage() call in the else is a hack to ensure that osgCompute cannot overwrite the buffer with the original image again when mapping the buffer to the device. This code so far has been tailored to simply try get it to work based on the original example; I can image this not being to best approach however. 
 
Sincerely,
     Asmar B. Arsala
 
(for code snippets see attachment) 		 	   		  
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091104/a2ae16ba/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CodeSnippets.cpp
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091104/a2ae16ba/attachment.txt>


More information about the osg-users mailing list