PDA

View Full Version : FBO: dump contents of a GL_RENDERBUFFER_EXT to the back buffer



Sansus
01-12-2006, 02:24 AM
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,framebuffe rid_x_rendertarget[src->GetRenderTargetUniqueID()]);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);

glCopyPixels(0,0,src->GetWidth(),src->GetHeight(),GL_COLOR);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,framebuffe rid_x_rendertarget[src->GetRenderTargetUniqueID()]);Can anyone help me?

sqrt[-1]
01-12-2006, 04:02 AM
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?

Sansus
01-12-2006, 04:47 AM
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.

shelll
01-12-2006, 06:34 AM
there are NPOT textures

Sansus
01-12-2006, 07:00 AM
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?

Zulfiqar Malik
01-12-2006, 09:11 AM
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.

Michael Gold
01-12-2006, 09:37 AM
I know this doesn't help you today, but this is the exact kind of problem EXT_framebuffer_blit (http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_blit.txt) is designed to solve. This new extension should be available soon.

Sansus
01-13-2006, 03:03 AM
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.