FBO problem on ATI

I know this problem has been asked and asked… and I’ve also spend time trying to search a solution on the web, but I couldn’t :frowning: I will be really appreciated if anyone can help me.

The problem is weird. My FBO code works correctly with older version of ATI driver. (I’m using ATI Radeon 2400) After I upgraded the driver to the latest one, it couldn’t work!! There is an error of GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT. I don’t understand…

I tried nearly every version of driver on the web… I found that the code works well with all the versions before April 2008, but not with later versions. However, I need newer versions cause they fixed a critical bug.

Can anyone help me? I don’t know what to do now…

	GLuint fbo;
	glGenFramebuffersEXT(1, &fbo);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);

	GLuint depthbuffer;
	glGenRenderbuffersEXT(1, &depthbuffer);
	glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthbuffer);

	glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, w, h);
	glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthbuffer);

	GLuint img;
	glGenTextures(1, &img);
	glBindTexture(GL_TEXTURE_2D, img);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	
	if(glGetError() != GL_NO_ERROR) 
	{
		std::cerr << "Texture " << img << " creation failed." << endl;
	}

	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, img, 0);

	glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);

// to detect errors
	checkFramebufferStatus();

GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT

That means that you have done something that is clearly against the FBO setup process. Well, unless ATi’s FBO stuff isn’t working. But it’s just as possible that the older driver wasn’t getting the job done, and it uncovered a bug in your code.

According to the EXT_FBO spec:

  * The value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT must not be
    NONE for any color attachment point(s) named by DRAW_BUFFERi.
    { FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT }

But it looks like you’re doing what you’re supposed to (setting glDrawBuffer). Do you have multiple draw buffers?

Hi Korval,

I only have one drawing buffer. Also, I found an ATI’s guide for setting up FBO. I copied the codes into my program, and it still can’t work (with the same error)

Here is the document:
http://developer.amd.com/media/gpu_assets/FramebufferObjects.pdf

brynn,
Try to set GL_GENERATE_MIPMAP token to GL_TRUE right before glTexImage2D().


glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);


What is the current READ_BUFFER?

Hi songho,

It works!!! Thank you so much! :smiley: Amazing…

That’s a driver bug. Per spec issue 43, there is no requirement for fbo attachments to be mipmap complete.

Well, I think the bug is in glCheckFramebufferStatusEXT() on ATI/AMD driver. Sometimes, I noticed glCheckFramebufferStatusEXT() reports incorrect(not relevant) FBO status on ATI cards when it failed to complete a FBO.

However, this issue is still valid on ATI cards. If texture min filter does NOT use mipmaps (e.g. GL_LINEAR), then a FBO completion is successful on ATI cards. It will be failed only if min filer is involved with mipmaps.

Just ran into the same issue on a HD4650/Cat8.11.

Interestingly, following TexImage2D with a GenerateMipmap() in place of the GENERATE_MIPMAP parameter was ineffective. (In addition to the above, setting TEXTURE_MAX_LEVEL to 0 seems to work too.)

Anyway, now that GENERATE_MIPMAP is deprecated, that should eliminate all texture image specification relevance in the TexParameter API, leaving only the sampler specific parameters (unless I missed something).