Reputation: 309
I am using openGL ES 2.0 and GLSL shader and working on FBO with Renderbuffer, aka offscreen rendering.
It works fine with 30 fps.
But when I use glReadPixels or glcopyteximage2d, it drops to 8 fps.
I did something like:
glBindFramebuffer(GL_FRAMEBUFFER, frameBuf);
//DRAW something
glReadPixels(...); //HERE
glBindFramebuffer(GL_FRAMEBUFFER, 0);
Is there anyway I can improve the speed? I mean when I don't use FBO and use glReadPixels with same parameters, it works 15 fps and I thought using FBO could improve the speed?
Upvotes: 3
Views: 3613
Reputation: 6942
It's bad (very bad) way to get OpenGL data (using any of glGet***
functions). To copy texture or some it's part to screen/other texture you may draw it with quad. If you need pixels data for some logical processing, it would be better to make framebuffer as small as possible and read it only when necessary.
Upvotes: 5