OptixPrime / CUDA / OpenGL interop


I am using the CUDA/OpenGL interop to construct a linear array of rays (to be tested later with Optix Prime) with information from an OpenGL shader. But I would also like to pass this CUDA-OpenGL-shared pointer to Optix Prime as the ray Buffer.

I’m using the functions: cudaGraphicsGLRegisterBuffer, cudaGraphicsMapResources and cudaGraphicsResourceGetMappedPointer

I’ve read that once CUDA has created a context, Optix should use it instead of creating a new one, although I don’t quite understand how. When I do create a new OptixPrime context there’s no compilation or running error but the interoperability between OpenGL and CUDA stops working.

Is it even possible to have OptixPrime/CUDA/OpenGL interoperability? And how exactly I should use the already created CUDA context?

Can a CUcontext * can be casted as a RTPcontext


Never mind, I finally got it working using the c++ wrapper for Optix Prime. Once I create a new context I guess it automatically takes the one from CUDA.

Thanks anyway.