Copying FBO attached texture to a smaller FBO

Hi board,

I’m trying to implement (parts of) the depth of field effect as described in the StarCraft II paper (link) 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(FrameBufferObject &other, GLbitfield mask){
	glPushAttrib(GL_ALL_ATTRIB_BITS);

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

	glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);

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

	glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, 0);
	glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0);

	glPopAttrib();
}

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?

Thanks.