View Full Version : Copying FBO attached texture to a smaller FBO

05-19-2010, 07:05 AM
Hi board,

I'm trying to implement (parts of) the depth of field effect as described in the StarCraft II paper (link (http://ati.amd.com/developer/siggraph08/chapter05-filion-starcraftii.pdf)) and currently I've implemented something along the lines of it; however there's one part I can't get to work. The paper talks about downscaling the framebuffer to do some of the blurring effects on a texture 1/4th the size.

However, every time I try to copy the content of the framebuffer to a smaller texture using glBlitFramebufferEXT I get a black texture. However, if the dimensions of the source and destination FBO are the same, the copy succeeds.

This doesn't seem to be an glBlitFramebufferEXT issue, however, because when I copy the texture manually using a fullscreen quad that I render to the destination FBO, I get the same results.

Here's the code I use to copy one FBO to another:

// somehow this only works if m_Width == other.GetWidth() && m_Height == other.GetHeight()
void FrameBufferObject::RenderToOtherFBO(FrameBufferObj ect &other, GLbitfield mask){

glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_fboId[0]);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, other.m_fboId[0]);


0, 0, m_Width, m_Height,
0, 0, other.GetWidth(), other.GetHeight(),
mask, GL_LINEAR); // GL_NEAREST doesn't make a difference



The source FBO is constructed with two textures and a depth buffer attached, the destination FBO just has two textures attached. When the texture's internalFormat is GL_RGBA the result is a black texture; however my usecase needs GL_RGBA32F_ARB textures because of HDR rendering. If I use those, the result is an ugly yellowish texture.

I'm testing this on a GeForce 8M series card, do you guys have any suggestions regarding the problems I'm having?