tchau83
10-12-2010, 02:54 AM
I have an application where I do rendering and then read back the rendered image. I do not need to use the readback data for rendering. Previously I used PBOs and framebuffers to read back the image, i.e.,
while()
{
render()
swapBuffers()
glBindBuffer(GL_PIXEL_PACK_BUFFER,pbo1);
glReadPixels()
ptr = glMapBuffer(GL_PIXEL_PACK_BUFFER,pbo2);
//read back image
//swap pbo1 and pbo2 for next iteration
}
Now I want to use FBO instead of framebuffers. If I use a single fbo and a renderbuffer, I suspect that the GPU will not start to render the next frame until the renderbuffer data has been copied to PBO, thus causing a stall. I'm thinking of creating two renderbuffers and render to one while reading from another (like in my previous method with framebuffers), but a FBO only has one depth attachment point. I can use 2 FBOs, but I read somewhere that switching between FBOs are slow.
Speed is crucial in my application, so stalls have to be avoided. There is also not much for the CPU to do while waiting for the GPU to transfer the pixel data.
Any suggestions on what can I do? Thanks in advance
while()
{
render()
swapBuffers()
glBindBuffer(GL_PIXEL_PACK_BUFFER,pbo1);
glReadPixels()
ptr = glMapBuffer(GL_PIXEL_PACK_BUFFER,pbo2);
//read back image
//swap pbo1 and pbo2 for next iteration
}
Now I want to use FBO instead of framebuffers. If I use a single fbo and a renderbuffer, I suspect that the GPU will not start to render the next frame until the renderbuffer data has been copied to PBO, thus causing a stall. I'm thinking of creating two renderbuffers and render to one while reading from another (like in my previous method with framebuffers), but a FBO only has one depth attachment point. I can use 2 FBOs, but I read somewhere that switching between FBOs are slow.
Speed is crucial in my application, so stalls have to be avoided. There is also not much for the CPU to do while waiting for the GPU to transfer the pixel data.
Any suggestions on what can I do? Thanks in advance