modifying a texture how to change values in the texture array?

Hi all,

I am a beginner with CUDA, and it is exciting!
I am playing with the SDK example “volume rendering” (

It is a very simple example, perfect to understand.

I’d like to modify the 3D texture on the fly. Is it possible ?
I have read a lot of stuff about memory and CUDA but I don’t understand everything yet…

It is unclear if it is possible to modify the texture array on the fly. If YES, how ? :D
If no, is it possible to copy the entire new texture on the fly ? and how ?!

On the example, the texture is stored on “cudaArray *d_volumeArray = 0;”
Maybe I have to change the type of memory but for which one ?

Thanks a lot for your help.

– Pium

my voxelPlancton code (which is based on the volume visualization sample) changes the 3D texture
when the user presses one of the cursor keys. Not sure if this qualifies as “on the fly”.

the new data has to pass through the host though, as it has to be copied into the 3D texture.

You can search for it on the forums.


Indeed, I try to keep the original texture on the host memory, to modify it on the host and to copy it globally as during the init and YES it works. It is not as beautiful as I would like, but at less it works :)

Thanks for your answer, I am going to check if I can find your code.


I finally found VoxelPlancton here :…voxel-plancton/
but not on this forum

unfortunately it does not work on my machine…

But I can check the source code and it is basically the same thing I have done (expect I build the texture on the host and copy it from the host to the device, and you are building the texture on the device also)

On your case, the texture seems to be completely different, so the method is coherent.
But if only a small part of the texture is modified, do you think there is a way to only copy the new values at the right place in memory?

Thanks for your help!

– Pium

My thread is here

I find my version less boring than the original SDK sample. ;)

I saw your thread, but I did not find a link to the program on it.