I am the new Opengl programmer, my goal is to get the depth buffer in FBO so that I can transfer to kuda without using glReadpixels.
Here is what I have already done:
void make_Fbo()
{
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER,
fbo);
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");
}
This code creates my FBO with the correct depth values.
A new problem has appeared, according to the article “Fast triangular rasterization using an irregular z-buffer on cuda”. Unable to connect to the depth buffer attached to Cuda's FBO.
Here is a quote from the article:
FBO . , , CUDA. [...] FBO. . GLSL [KBR06], gl_FragCoord
?
?
?