FBO + ATi card == problem?

I’ve got a problem.

The following FBO code (setup; bind / unbind not shown here) runs perfectly fine on my NVidia video card:



--------------------< CreateFBO( .. ) from Texture object >--------------------

// Set-up texture
Bind(this);
Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA8, oglWidth, oglHeight, 0, Gl.GL_RGBA, Gl.GL_UNSIGNED_BYTE, null);
this.ApplyTexFlags( .. );

// Create objects
Gl.glGenFramebuffersEXT(1, out this.framebufferID);
Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, this.framebufferID);

// Attach texture to FBO
Gl.glFramebufferTexture2DEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_COLOR_ATTACHMENT0_EXT, Gl.GL_TEXTURE_2D, this.textureID, 0);

// Initialize Depthbuffer
if (reqZBuffer)
{
	Gl.glGenRenderbuffersEXT(1, out this.depthbufferID);
	Gl.glBindRenderbufferEXT(Gl.GL_RENDERBUFFER_EXT, this.depthbufferID);
	Gl.glRenderbufferStorageEXT(Gl.GL_RENDERBUFFER_EXT, Gl.GL_DEPTH_COMPONENT, oglWidth, oglHeight);
	Gl.glFramebufferRenderbufferEXT(Gl.GL_FRAMEBUFFER_EXT, Gl.GL_DEPTH_ATTACHMENT_EXT, Gl.GL_RENDERBUFFER_EXT, this.depthbufferID);
}

// Status check
<code stuff>

// Unbind all to regularily continue drawing operations
Gl.glBindRenderbufferEXT(Gl.GL_RENDERBUFFER_EXT, 0);
Gl.glBindFramebufferEXT(Gl.GL_FRAMEBUFFER_EXT, 0);
Bind(lastBound);

-----------------------------------------------------------------------------------


--------------------< ApplyTexFlags( .. ) from Texture object >--------------------

if ((this.texflags & TexFlag.EdgeClamp) != 0)
{
	Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_WRAP_S, Gl.GL_CLAMP_TO_EDGE);
	Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_WRAP_T, Gl.GL_CLAMP_TO_EDGE);
}
if ((this.texflags & TexFlag.Smooth) != 0)
{
	if ((this.texflags & TexFlag.MipMap) != 0)
	{
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR_MIPMAP_LINEAR);
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
		Gl.glGenerateMipmapEXT(Gl.GL_TEXTURE_2D);
	}
	else
	{
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_LINEAR);
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_LINEAR);
	}
}
else
{
	if ((this.texflags & TexFlag.MipMap) != 0)
	{
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST_MIPMAP_LINEAR);
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_NEAREST);
		Gl.glGenerateMipmapEXT(Gl.GL_TEXTURE_2D);
	}
	else
	{
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MIN_FILTER, Gl.GL_NEAREST);
		Gl.glTexParameteri(Gl.GL_TEXTURE_2D, Gl.GL_TEXTURE_MAG_FILTER, Gl.GL_NEAREST);
	}
}

-----------------------------------------------------------------------------------

As i said: The code runs perfectly fine. But not an ATi cards… why and how can I fix it? I’ve searched via google but found absolutely nothing that helped. :stuck_out_tongue:

What is wrong ?

I have an ATI card and for the colour attachment I use GL_RGBA16F_ARB texture. Works for me. But I found a lot of stupid problems in general where changes that defy any logical reasoning fix the problem.

For example on one of the nVidia cards the following GL_DEPTH_COMPONENT16_ARB depth buffer wouldn’t work. I had to change it to GL_DEPTH_COMPONENT32_ARB. And everything worked. I didn’t bother investigating why.

If you use on ATI what about CheckFramebufferStatus ?

I just replaced GL_RGBA16F_ARB with GL_RGBA8. It works for me. The framebuffer status is complete. I’m using ati x1500.

INCOMPLETE_ATTACHMENT

Note that I don’t actually attach a depth renderbuffer - although it is supported I don’t use it yet, reqZBuffer is never true. So, basically I’m only attaching a color texture.

INCOMPLETE_ATTACHMENT

Note that I don’t actually attach a depth renderbuffer - although it is supported I don’t use it yet, reqZBuffer is never true. So, basically I’m only attaching a color texture.[/QUOTE]

I saw ATI FBO’ demo. There was using depth attaching.
I think it good idea always attach depth :slight_smile:

Ok, I’ll test it. Thanks! :slight_smile:

I don’t attach depthbuffer either and it works.
There is something else wrong.

I had one case where FBO completeness check failed on the ATI card when I uploaded and rendered aproximatelly 1GB of textures (on Radeon 3870 X2 which effectively has 512MB of memory) before I first attempted to use a depth texture with the FBO.