Create Depth Renderbuffer in CUDA

I need to use CUDA to fill a depth buffer with values. I am receiving an error when I attempt to register the renderbuffer from OpenGL (that is set as a depth buffer) using cudaGraphicsGLRegisterImage. Is this possible and if so how? Thanks.


I had the same problem and i never found a solution to bind a depth buffer to CUDA.

On the other hand, you could just map a texture to cuda and write the depth to it using a different type (color type) and use the texture in your OpenGL shader programs.

My problem was to bind a depth buffer to cuda and read from it. I solved it by rendering the depth in OpenGL to a “color” channel and used the “color” channel in cuda to get the depth.

Maybe you could use the same procedure but in reverse :)

I also have the same problem of reading depth buffer from CUDA. Could you give me more hints about how to render the depth in OpenGL to a color channel?