PDA

View Full Version : FBO problem



Schinizer
09-08-2010, 03:52 AM
Hi all,

I've met some problems with FBOs.

When I go through some intensive testing for my program, sometimes I couldn't initialize the FBO (Error returned was GL_FRAMEBUFFER_UNSUPPORTED_EXT) when I start my program.

It auto fixes sometimes when I leave the com for awhile (Yes I know it sound stupid)
Or sometimes I couldn't initialize again until I restart my computer.

My drivers are the latest.

I've met this problem on a 9300m GS, 9600m GS and a GTX285m. I've tried my code on a ATI HD5870 and I have never meet this problem.

Anyone met the same problem as me? Or its just me?

strattonbrazil
09-08-2010, 04:52 PM
Could you post your init code and your operating system?

Schinizer
09-08-2010, 09:23 PM
I am using windows 7 32bit. It looks something like this:


glGenFramebuffersEXT(1, &m_fbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);

m_offScreenTextures["ColorBuffer"] = CreateTexture(m_fboTarget, m_fboInternalFormat, m_fboFormat, m_fboType, GL_COLOR_ATTACHMENT0_EXT);
AttachTextureToFBO("ColorBuffer", GL_COLOR_ATTACHMENT0_EXT);

glGenRenderbuffersEXT(1, &m_fboDepthBuffer);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_fboDepthBuffer);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, m_fboWidth, m_fboHeight);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_fboDepthBuffer);

CheckFramebufferStatus();

int actualWidth = 0;
int actualHeight = 0;

glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EX T, GL_RENDERBUFFER_WIDTH_EXT, &actualWidth);
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EX T, GL_RENDERBUFFER_HEIGHT_EXT, &actualHeight);

assert(actualWidth == m_fboWidth);
assert(actualHeight == m_fboHeight);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

strattonbrazil
09-10-2010, 08:12 AM
It's kind of hard to see what's going on with those non-OpenGL calls like CreateTexture. Are those yours or from a library?

ZooVFR
09-13-2010, 11:28 PM
Hi Guys, I have the same problem. My application is working fine few hours, then when I try to start it again I get this error.

I'm working on W7 64bit, and I have Quadro Fx 5800 with newest driver.

Here is my context resize function:

if(m_frameBufferID)
{
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteRenderbuffersEXT(1, &m_depthBufferID);
glBindTexture(GL_TEXTURE_2D, 0);
glDeleteTextures(GE_NROFBACKBUFFERS, m_colorBufferID);
}
else
{
glGenFramebuffersEXT(1, &m_frameBufferID);
assert(m_frameBufferID);
}

m_actualSize[0] = sizeX;
m_actualSize[1] = sizeY;

glGenTextures(GE_NROFBACKBUFFERS, m_colorBufferID);
glGenRenderbuffersEXT(1, &m_depthBufferID);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_frameBufferID);

for(i = 0; i < GE_NROFBACKBUFFERS; i++)
{
glBindTexture(GL_TEXTURE_2D, m_colorBufferID[i]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, sizeX, sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + i, GL_TEXTURE_2D, m_colorBufferID[i], 0);
}

glBindTexture(GL_TEXTURE_2D, 0);

if(!glRenderbufferStorageMultisampleEXT)
m_samples = 0;

glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthBufferID);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_EXT, sizeX, sizeY);

glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthBufferID);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthBufferID);

GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);

assert(status == GL_FRAMEBUFFER_COMPLETE_EXT);
}