Hi all,
I am trying to map an opengl render buffer to a cuda pointer by using cudaGraphicsGLRegisterImage, but the function returns the error cudaErrorInvalidValue.
The render buffer is associated to the deth buffer of a frame buffer.
glGenFramebuffersEXT(1, &_fbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, _fbo);
glGenRenderbuffersEXT(1, &_rbo);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, _rbo);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width(), height());
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
// attach a texture to FBO color attachement point
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, _tex, 0);
// attach a renderbuffer to depth attachment point
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, _rbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
cutilSafeCall( cudaGraphicsGLRegisterImage(&_cuda_resources[1], _rbo, GL_RENDERBUFFER, cudaGraphicsMapFlagsNone ) ); ==> cudaErrorInvalidValue
When I do it with a 2D texture it works well
cutilSafeCall( cudaGraphicsGLRegisterImage(&_cuda_resources[1], _tex, GL_GL_TEXTURE_2D, cudaGraphicsMapFlagsNone ) );
Do I have to respect something regarding the render buffer?
edit: do you know if it is possible to do the same with a 3D texture?
Thanks
–pium