glCheckFramebufferStatusEXT status is 36061

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;
    }
}

0x8CDD is GL_FRAMEBUFFER_UNSUPPORTED.

According to the reference page;

but what can I do with this value? how can I know why I get this return value?
Is there any debugging method that I can do?
Thanks !

There isn’t much you can do with it. You can play around with different image formats. But unless NVIDIA’s debug reporting gives you more information, the only things you can do to guarantee that you won’t get framebuffer unsupported are:

  1. Stop using a nearly 2-decade old extension and instead use the core framebuffer object functionality.
  2. Stick to the required image formats for framebuffers; implementations are not allowed to give you “framebuffer unsupported” if all of your image formats are on that list.

what do you mean by image format? from the above code, I found that I used glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBufferId) twice, one is at the beginning of the method, the other one is just before the status check. Where to set the image format for bind framebuffer?

For more detailed, info, check out:

In particular, the queries:

  • GL_COLOR_RENDERABLE
  • GL_DEPTH_RENDERABLE
  • GL_STENCIL_RENDERABLE
  • GL_FRAMEBUFFER_RENDERABLE
  • GL_FRAMEBUFFER_RENDERABLE_LAYERED
  • GL_FRAMEBUFFER_BLEND

The internalformat parameters to glRenderbufferStorage.

You’re using GL_RGB10_A2 for the colour buffer and GL_DEPTH_COMPONENT32 for the depth buffer. GL_RGB10_A2 is a required colour-renderable format, but GL_DEPTH_COMPONENT32 isn’t a required format; implementations aren’t required to support it, and even if it’s supported for textures it isn’t required to be renderable or supported for renderbuffers.

GL_DEPTH_COMPONENT24, GL_DEPTH24_STENCIL8 and GL_DEPTH_COMPONENT32F are required depth-renderable formats.

GL_DEPTH_COMPONENT32F requires OpenGL 3.0 or the GL_ARB_depth_buffer_float extension.

do you have a suggestion to paint using new API? I also need to paint 10bit color images, please share an example about using new API, thanks!