GL_DEPTH_COMPONENT support in CUDA GL interop

I’m trying to perform combined rendering with OpenGL for polygonal rendering and CUDA for volume rendering. My idea is to render the OpenGL scene into a framebuffer, then use that color and depth buffer as input to my CUDA renderer, using it in the same way as OpenGL does, so I get proper alpha and depth compositing.

However, I’m running into a problem. When I call:

glGenTextures(1, &m_tex_color);

glGenTextures(1, &m_tex_depth);

glBindTexture(GL_TEXTURE_2D, m_tex_color);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_iWidth, m_iHeight, 0,

             GL_RGBA, GL_UNSIGNED_BYTE, 0);

glBindTexture(GL_TEXTURE_2D, m_tex_depth);

glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, m_iWidth, m_iHeight, 0,  


glBindTexture(GL_TEXTURE_2D, 0);

glGenFramebuffersEXT(1, &m_fbo);

glBindFramebuffer( GL_FRAMEBUFFER, m_fbo);


                       GL_TEXTURE_2D, m_tex_color, 0 );


                       GL_TEXTURE_2D, m_tex_depth, 0 );

cudaError_t b;

b = cudaGraphicsGLRegisterImage(&m_cuda_color_resource, m_tex_color,

                                GL_TEXTURE_2D, cudaGraphicsMapFlagsNone);

printf("%s",  cudaGetErrorString(b));

b = cudaGraphicsGLRegisterImage(&m_cuda_depth_resource, m_tex_depth,

                                GL_TEXTURE_2D, cudaGraphicsMapFlagsNone);

printf("%s",  cudaGetErrorString(b));

I get no error on the first cudaGraphicsGLRegisterImage, but an “invalid argument” error on the second. Does CUDA 3.2 not support registering depth component textures? Does 4.0 (when it comes out)? Is there another way to approach this that I’m missing?