OpenGL texture in cudaArray


I would like to use an OpenGL texture in CUDA as a texture. If I understood right, you can use PBO to access the opengl texture in CUDA (using a PBO and ReadPixels). However, this PBO is linear memory, and not a cudaArray. However, I would like to use texture filtering which requires the memory to be a cudaArray. The only way I can see is that I have to do a second copy from linear memory (registered PBO) to a cudaArray and bind it as texture in CUDA.

Any ideas in how to get rid of the second copy?


Wait for the next release, or sample the texture in GL. This is not currently implemented. Even PBO is memcpyed behind our back (according to nVidia).

There’s a sample in CUDA SDK that demostrates OpenGL and CUDA interoperability with textures. Take a look at that as a starting point. You bind buffers to CUDA objects. There’s only one implied memcopy involved.