FBO: dump contents of a GL_RENDERBUFFER_EXT to the back buffer

Hello. I’m trying to write a multi-pass rendering algorithm and I want to use a RENDERBUFFER stored in a FBO as an accumulation buffer. In the end, I want to copy the contents of the renderbuffer to the back buffer.

I’m trying with this code, but doesn’t seems to work:

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,framebufferid_x_rendertarget[src->GetRenderTargetUniqueID()]);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);

glCopyPixels(0,0,src->GetWidth(),src->GetHeight(),GL_COLOR);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,framebufferid_x_rendertarget[src->GetRenderTargetUniqueID()]);

Can anyone help me?

I am unsure if you can use glCopyPixels in that case.

Any reason you can’t simply use a texture based FBO (instead of a render buffer) and draw a quad over the screen?

Because I want to achieve a pixel exact correspondence between the back buffer and the renderbuffer. If I’d use a texture I should use a texture with the same size of the screen. And it will not be power of two.

There must be a method to dump data between hardware buffers, I guess.

there are NPOT textures

The problem of using glCopyPixels is that pixels can not be copied between buffers belonging to different framebuffer objects. However it can be used to copy pixels between buffers inside the same framebuffer object.

So I will try to use ARB_texture_non_power_of_two or ARB_texture_rectangle… ¿Which extension should I use?

ARB_texture_non_power_of_two is the more standard extensions, whereas ARB_texture_rectangle, although faster, is not available on ATI hardware. You can use regular POT textures, if you are targetting older hardware, and are not short on memory.

I know this doesn’t help you today, but this is the exact kind of problem EXT_framebuffer_blit is designed to solve. This new extension should be available soon.

I know this doesn’t help you today, but this is the exact kind of problem EXT_framebuffer_blit is designed to solve. This new extension should be available soon.
Wow! This is the functionality I was looking for. So I will use ARB_texture_non_power_of_two for now and will migrate to EXT_framebuffer_bit when available.

Thanks to you all.