Discussion:
Framebuffer, incomplete attachment (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT)
(too old to reply)
GF
2012-11-15 20:51:41 UTC
Permalink
Hi,

I get that error in my code on an Nexus7 and some other devices. See the
coments.


glGenFramebuffersExt( 1, &m_frameBuffer );
OPENGL_CHECK_ERRORS();
if(!m_frameBuffer)
{
return false;
}
glBindFramebufferExt( GL_FRAMEBUFFER_EXT, m_frameBuffer );

// bind texture (2012-oct-17 moved before depth buffer)
glFramebufferTexture2DExt( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, texture, 0 );
OPENGL_CHECK_ERRORS();

// depth buffer
glGenRenderbuffersExt( 1, &m_depthRenderBuffer );
OPENGL_CHECK_ERRORS();
if(!m_depthRenderBuffer)
{
Clear();
return false;
}

glBindRenderbufferExt( GL_RENDERBUFFER_EXT, m_depthRenderBuffer );
OPENGL_CHECK_ERRORS();

glRenderbufferStorageExt( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT32, w,
h);
if(glGetError() == GL_INVALID_ENUM)
{
g_debug("depth 32 failed, try 24\n");
glRenderbufferStorageExt( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24,
w, h);
}
if(glGetError() == GL_INVALID_ENUM)
{
g_debug("depth 32 failed, try 16\n");
glRenderbufferStorageExt( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
w, h);
}

OPENGL_CHECK_ERRORS();
glFramebufferRenderbufferExt( GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthRenderBuffer );
OPENGL_CHECK_ERRORS();

// Check for errors after binding it
GLenum status = glCheckFramebufferStatusExt( GL_FRAMEBUFFER_EXT );
Here I get: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT

Any idea why? I have the impression that glRenderbufferStorageExt might not
give an correct error value when it fails.
What can I do?
Nobody
2012-11-15 22:38:05 UTC
Permalink
Post by GF
// bind texture (2012-oct-17 moved before depth buffer)
glFramebufferTexture2DExt( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, texture, 0 );
You should provide the commands which were used to create and initialise
"texture".
Post by GF
// Check for errors after binding it
GLenum status = glCheckFramebufferStatusExt( GL_FRAMEBUFFER_EXT );
Here I get: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
That implies that one of the attachments (colour or depth) isn't
"framebuffer attachment complete". My guess would be the colour
attachment, as you don't give any details about the nature of the texture;
there doesn't appear to be anything wrong with the depth attachment.
Post by GF
Any idea why? I have the impression that glRenderbufferStorageExt might not
give an correct error value when it fails.
What can I do?
Post a minimal example which compiles and which is supposed to work, but
doesn't.
GF
2012-12-04 19:20:39 UTC
Permalink
Post by Nobody
Post by GF
// Check for errors after binding it
GLenum status = glCheckFramebufferStatusExt( GL_FRAMEBUFFER_EXT );
Here I get: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
That implies that one of the attachments (colour or depth) isn't
"framebuffer attachment complete". My guess would be the colour
attachment, as you don't give any details about the nature of the texture;
there doesn't appear to be anything wrong with the depth attachment.
The colour buffer gets done like this:

glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glGenTextures(1, pTextureID);

glBindTexture(GL_TEXTURE_2D, *pTextureID);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex.m_sizex, tex.m_sizey, 0,
GL_RGBA, GL_UNSIGNED_BYTE, tex.m_txdata);


Anything wrong here? Anything I should check for errors here?
Nobody
2012-12-04 20:20:43 UTC
Permalink
Post by GF
Anything wrong here? Anything I should check for errors here?
I don't see any issues.

For a 2D, non-multisampled, RGBA texture, about the only constraint is
that the dimensions are greater than zero and less than the
implementation-defined maximum framebuffer size.

You might try calling glBindTexture(GL_TEXTURE_2D, 0) after attaching it
to the framebuffer. The behaviour is undefined if the same texture is used
as both source and destination (although this shouldn't make the
framebuffer incomplete).
l***@gmail.com
2013-11-15 05:57:08 UTC
Permalink
Post by GF
Hi,
I get that error in my code on an Nexus7 and some other devices. See the
coments.
glGenFramebuffersExt( 1, &m_frameBuffer );
OPENGL_CHECK_ERRORS();
if(!m_frameBuffer)
{
return false;
}
glBindFramebufferExt( GL_FRAMEBUFFER_EXT, m_frameBuffer );
// bind texture (2012-oct-17 moved before depth buffer)
glFramebufferTexture2DExt( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, texture, 0 );
OPENGL_CHECK_ERRORS();
// depth buffer
glGenRenderbuffersExt( 1, &m_depthRenderBuffer );
OPENGL_CHECK_ERRORS();
if(!m_depthRenderBuffer)
{
Clear();
return false;
}
glBindRenderbufferExt( GL_RENDERBUFFER_EXT, m_depthRenderBuffer );
OPENGL_CHECK_ERRORS();
glRenderbufferStorageExt( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT32, w,
h);
if(glGetError() == GL_INVALID_ENUM)
{
g_debug("depth 32 failed, try 24\n");
glRenderbufferStorageExt( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24,
w, h);
}
if(glGetError() == GL_INVALID_ENUM)
{
g_debug("depth 32 failed, try 16\n");
glRenderbufferStorageExt( GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16,
w, h);
}
OPENGL_CHECK_ERRORS();
glFramebufferRenderbufferExt( GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthRenderBuffer );
OPENGL_CHECK_ERRORS();
// Check for errors after binding it
GLenum status = glCheckFramebufferStatusExt( GL_FRAMEBUFFER_EXT );
Here I get: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
Any idea why? I have the impression that glRenderbufferStorageExt might not
give an correct error value when it fails.
What can I do?
Loading...