PDA

View Full Version : FBO + ATi card == problem?



Fetze
07-07-2008, 07:13 AM
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. :p

innuendo
07-07-2008, 08:14 AM
What is wrong ?

Budric
07-07-2008, 09:01 AM
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.

innuendo
07-07-2008, 09:25 AM
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 ?

Budric
07-07-2008, 12:52 PM
I just replaced GL_RGBA16F_ARB with GL_RGBA8. It works for me. The framebuffer status is complete. I'm using ati x1500.

Fetze
07-10-2008, 05:00 AM
What is wrong ?

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.

innuendo
07-10-2008, 07:15 AM
What is wrong ?

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.

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

Fetze
07-10-2008, 09:19 AM
Ok, I'll test it. Thanks! :)

Eosie
07-10-2008, 09:23 AM
I don't attach depthbuffer either and it works.
There is something else wrong.

Komat
07-10-2008, 09:48 AM
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.