Can I copy the opengl texture image to cuda device memory using the “cuMemcpy()”,“cuMemcpy2D()” API directly? Until now,I plan to use PBO & FBO to do that,firstly bind the source texture to FBO,and then use “glReadPixels()” to copy image to PBO,then map PBO to CUDA and get the mapped dptr of PBO,after that I can use CUDA API to copy image to device memory;It is not a good way I think,I know the CUDA function “cuGraphicsGLRegisterImage()” can register an OGL texture to cuda environment,but I can only get a “CUarray” ptr through “cuGraphicsSubResourceGetMappedArray()” API, I don’t how to copy “CUarray” ptr to “CUdeivceptr” ptr,any one can tell me how to do it?Is there any way to copy OpenGL texture to cuda dev memory directly?
I had find the way to do,use “cuMemcpy2()” function,and set the “srcMemoryType” to CU_MEMORYTYPE_ARRAY.
I’ve tried copying from device memory to cuda arrays (bound by texture) withough issues so I guess the other way around should also work?