glCheckFramebufferStatus return 0 and glGetError() return 0 either

Hi, I recently encountered a problem when trying to run my codes on another computer. I got glCheckFramebufferStatus() return 0 but didn’t get any error code from glGetError().

The codes work totally fine on my computer (with nvidia driver 418.56) but not on the current one (nvidia driver 450.51.06). Is that safe to say this is a driver issue?

BTW, both opengl versions are 4.6.0

Here’s the code snippet:

    glGenFramebuffers(1, &f.FBO);
    glGenRenderbuffers(1, &f.color_buf);
    glGenRenderbuffers(1, &f.depth_buf);

    glBindRenderbuffer(GL_RENDERBUFFER, f.color_buf);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, w, h);

    glBindRenderbuffer(GL_RENDERBUFFER, f.depth_buf);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, w, h);

    glBindFramebuffer(GL_FRAMEBUFFER, f.FBO);

    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, f.color_buf);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, f.depth_buf);

    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if (status != GL_FRAMEBUFFER_COMPLETE)
      std::cout << "create frame buffer fail!" << std::endl;
    glBindFramebuffer(GL_FRAMEBUFFER, 0);

Feel free to give me some directions. Thanks for anything!

No, not yet.

This suggests that the glCheckFramebufferStatus() call encountered an error in the process of checking framebuffer completeness.

A few ideas:

  • Verify that you have GPU hardware accelerated graphics drivers installed on that machine.
  • Run the OpenGL Hardware Capability Viewer and see what it tells you about the drivers.
  • Are you sure you have a GPU hardware accelerated GL context bound before this?
  • Where are you getting the glCheckFramebufferStatus() function pointer?
  • Are you sure glGetError() is returning GL_NO_ERROR after all this?
  • Do something invalid. Does glGetError() return the expected error enum?
  • What does work? Have you successfully create a GL context and rendered to a window?

See also:

Hi Dark photon! Thanks so much for your reply. I tried a few of your ideas but got no luck. However, I finally find the bug and it’s caused by multiple threads.

It turns out that the codes running on another device are not exactly the same as those on my machine. The context is initialized on one thread but the codes of creating buffer and rendering are running on another thread.

I use eglMakeCurrent when initializing context and the context is only bind to the current thread and that’s why the error occurs.

Ok, thanks for following-up with the solution. So in your case, you didn’t have a bound GL context, causing glCheckFramebufferStatus() to return 0.

In the future, you could probably troubleshoot similar problems with eglGetCurrentContext()

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.