Most of the time, the code works fine. But once, I got glCheckFramebufferStatusEXT
status is 36061
10 times, which is 0x8cdd
, glBindFramebufferEXT
from officical doc. Does anybody know what is the meaning of this enum? And why this happens?
I used CUDA 11.6, and Nvidia driver 510.47
I searched a lot, and didn’t find any clue to debug and fix this occasional bug.
Thanks!
bool OpenglViewer::bindFbo(unsigned int width, unsigned int height)
{
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferId);
//We must bind color_rb before we call glRenderbufferStorageEXT
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, colorRenderBufferId);
//The storage format is RGBA8
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB10_A2, width, height);
//Attach color buffer to FBO
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, colorRenderBufferId);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depthRenderBufferId);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT32, width, height);
//Attach depth buffer to FBO
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthRenderBufferId);
//and now you can render to the FBO (also called RenderBuffer)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferId);
//Does the GPU support current FBO configuration?
GLenum status;
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
//std::wstring message = L"The glCheckFramebufferStatusEXT status is " + boost::lexical_cast<std::wstring>(status) + L".";
//ServiceManagerUtility::log(LOGLEVEL_ENG, message);
static int exceptionCount = 0;
static const int MAX_EXCEPTION_NUM = 10;
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
{
exceptionCount++;
if(exceptionCount <= MAX_EXCEPTION_NUM)
{
std::wstring message = L"The glCheckFramebufferStatusEXT status is " + boost::lexical_cast<std::wstring>(status) + L".";
ServiceManagerUtility::log(LOGLEVEL_SUP, message,ET_EXCEPTION);
}
if(exceptionCount == MAX_EXCEPTION_NUM)
{
ServiceManagerUtility::log(LOGLEVEL_ENG, openglexception::OPENGL_BINDFBO_ERROR_DESC, ET_ERROR, openglexception::MEMORY_ALLOCATION_FAILED_ID);
ServiceManagerUtility::reportError(openglexception::MEMORY_ALLOCATION_FAILED_ID);
}
return false;
}
else
{
exceptionCount = 0;
return true;
}
}