Here is the situation: I use 2 FBOs, 1 for image filtering resolution 640*480, the other for real rendering using filtered images resolution 1024*768. However the framerate is much lower than i expected, eg 30+ fps -> 15 fps. I checked each step of the code, and found that(this is a additional FBO i created):
// Render to our holefilling framebuffer
glBindFramebuffer(GL_FRAMEBUFFER, holeFillingFramebufferName);
//Attach depth buffer to the FBO
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthBufferTexture, 0);
// No color output in the bound framebuffer, only depth.
glDrawBuffer(GL_NONE);
// Always check that our framebuffer is ok
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
return false;
// image filtering staff
This part takes a long time, 30ms average I believe. So I commented glCheckFramebufferStatus
lines, and found the time was tranfered to the following part. I think this is because the system need time to prepare the FBO before the image filtering jobs start. I tried to change two FBOs to the same resolution, but it seemed make no difference.
Any tips to speed it up?
P.S. I work with OpenGL/glsl 3.3 with glfw, VS2010 Win7