Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader

2011-10-28 Thread Jens Orthmann
Hi Aurelien, have you tried to uncomment Code: ... pCudaTexture-setUsage(osgCompute::GL_TARGET_COMPUTE_TARGET); because what you really need is: Code: ... pCudaTexture-setUsage(osgCompute::GL_SOURCE_COMPUTE_TARGET); which is set by default. Another option is to take a look at our

Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader

2011-10-17 Thread J.P. Delport
Hi Aurelien, I'm not sure how to get you manual method working. It might have to do with multiple contexts? How are you running the shader? In pre-render pass? If so, you'll have to make sure the cuda code also executes in the pre-render stage. All I can add is that I'm mixing GLSL passes

Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader

2011-10-17 Thread Aurelien Albert
Hi, The Shader is executed as a normal osg shader program : by setting it on the node stateset. The Cuda code is executed before any rendering (before the pViewer-frame() call) By diggging in the osgCuda code source, it seems like cudaGraphicsMapResources and cudaGraphicsGLRegisterImage

Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader

2011-10-17 Thread J.P. Delport
Hi, On 17/10/2011 15:26, Aurelien Albert wrote: Hi, The Shader is executed as a normal osg shader program : by setting it on the node stateset. The Cuda code is executed before any rendering (before the pViewer-frame() call) By diggging in the osgCuda code source, it seems like

Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader

2011-10-17 Thread Aurelien Albert
To be more specific, I just need one function : copyCudaBufferToOsgTexture I thought osgCuda provide it, and I hope this is the first step for me before a complete migration from hand-made Cuda to osgCuda code. -- Read this topic online here:

Re: [osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader

2011-10-17 Thread J.P. Delport
Hi, I think search in the osgCuda code for Memcpy2D. I think the cuda shadow buffer that osgCuda makes is copied to the texture in the unmap(). There is possibly some other things like updating the texture dirty count as well so that OSG knows the texture has been changed. I'm sorry I can't

[osg-users] [osgCompute] Use an osgCuda::Texture2D in a shader

2011-10-14 Thread Aurelien Albert
Hi, I'm working on the port of a OpenGL / Cuda application to OSG / osgCuda. (OSG 3.0.1 with osgCuda from trunk) One of our class use Cuda to compute a buffer and then : - copy this buffer to a texture buffer (using cudaMemcpy) - bind this texture to a texture unit (using glBindTexture) - use