Are you sure your timer code is accurate and takes the asynchronous nature of the OpenGL API into account?
If you want some more reliable timer results, I suggest you use:
One other thing. I noticed you used glReadBuffer(GL_COLOR_ATTACHMENT1_EXT) and glReadBuffer(GL_BACK)
without switching from your application created FBO to you window system provided framebuffer.
I’m not 100%, but I think you can only use GL_COLOR_ATTACHMENTi_EXT for application created FBOs and GL_FRONT,GL_BACK,… for your window system provided framebuffer.
Are you sure your timer code takes the asynchronous nature of the OpenGL API into account?
I’m just using QTime (Qt) as timer, so probably not?
But my program goes very slow thanks to only these lines of code. When i remove them, it runs fast.
I tried your suggestion code to get an average time and it gave me: Readback time: 180.191 ms.
The code below gives no error in the first two checkErrors.
The last checkError gives: Error: invalid enumerant.
That’s because GL_BACK is not a valid enumerant for an application created FBO like I said in my previous post.
Have you tried using GL_BGRA instead of GL_RGBA?
First I render to 2 fbo textures with a shader. One fbo texture is used for reading back values from the gpu to the cpu with glReadPixels. This works on my other gpu in 6 ms and the values i get back are correct. I use them in my program on the cpu. The second fbo texture is used in rendering to the framebuffer.
The glTexImage2D line is located where the fbo and textures are initialy created. The glReadPixels line is located before fbo->unbind.