OpenGl textures into cuda linear memory how to use OpenGl textures with cuda

Hello,

I have a question concerning CUDA/OpenGL Interoperability.
Here is my concern :

I would like to “bind” 32 OpenGL textures to CUDA textures without
using FBOs (I am limited to 8) and without doing memcpy, just using a
list of GLuint corresponding to my textures ids.

So I was wondering if there is a way to read the data from the
textures inside a CUDA kernel just by using these texture ids given by
OpenGL ?

Thank you for your help.

I’m afraid you currently can only map buffer objects to CUDA. Hence the textures need to be first read to one or multiple pixel buffer objects which are then mapped to CUDA with cudaGLRegisterBufferObject followed by cudaMapBufferObject. This includes, however, an OpenGL internal “memcpy” (though the used OpenGL commands don’t have such a name but glBindBuffer followed by glReadPixels or glGetTexImage, as described in the GL_ARB_pixel_buffer_object specification).

In addition, I presume that the OpenGL framebuffer objects can’t be mapped to CUDA in the future either because they are actually merely a client-side encapsulation of a number of texture level image or renderbuffer handles. Instead, if I’ve understood the NVIDIA folks right, it should be possible to use the OpenGL textures on the CUDA side in a future release. What I don’t know, is whether they can be both written to and read from by CUDA, or only used as data source.

/Pyry