Does anyone have an idea of how to transfer and openGl FramebufferObject to cuda ?
Everything I found so far is marked as deprectated on my version of cude (6.5)
Does anyone have an idea of how to transfer and openGl FramebufferObject to cuda ?
Everything I found so far is marked as deprectated on my version of cude (6.5)
Here is a link to the non deprecated Graphics Interoperability for OpenGL in the current
release of the CUDA SDK.
[url]http://docs.nvidia.com/cuda/cuda-c-programming-guide/#opengl-interoperability[/url]
If this includes access to the depth buffer, I don’t really know.
Thanks for your reply,
I will read this guide and give a feedback of my progression.
void make_Fbo()
{
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER,
rb);
check_gl_error("make_fbo");
}
void make_render_buffer()
{
glGenRenderbuffers(1, &rb);
glBindRenderbuffer(GL_RENDERBUFFER, rb);
glRenderbufferStorage(GL_RENDERBUFFER,
GL_DEPTH_COMPONENT,
win.width,
win.height);
check_gl_error("make render_buffer");
}
cudaGraphicsResource *make_cuda_context()
{
struct cudaGraphicsResource *cu_fbo;
cuda_error("set device", cudaGLSetGLDevice(get_device()));
cuda_error("registerbuffer",cudaGraphicsGLRegisterBuffer(&cu_fbo,
fbo,
cudaGraphicsRegisterFlagsReadOnly));
return cu_fbo;
}
Up here are the 3 functions I’m using.
I first make the render buffer then the frame buffer object and finally bind it with the function make_cuda_context.
cudaGraphicsGLRegisterBuffer() return me “invalid resource handle” error.
Anyone have an idea why ?
Anyone got some help or any idea ?