Qt World Summit: Register Today!

QOpenGL on Mac - QCocoaGLContext: Falling back to unshared context

  • I'm working on a opengl-based application in qt. It renders scenes fine on linux and windows, but on mac I end up with a black window. I used QOpenGLDebugLogger to give me some clarity on the issue and it outputs this error:

    QCocoaGLContext: Falling back to unshared context

    What does it mean and is this the cause of my scene not being rendered on mac specifically? If so how can i fix the issue?

    The source for the project is here:

    Thanks in advance.

  • Lifetime Qt Champion

    200% mac noob but it seems to come from


    // retry without sharing on context creation failure.
    if (!m_context && m_shareContext) {
    m_shareContext = nil;
    m_context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
    if (m_context)
    qWarning("QCocoaGLContext: Falling back to unshared context.");

    and its just a warning.

    Did you check that openGL do work on the mac?


  • You were right, it's just a warning @mrjj .

    I fixed the issue by setting the default surface format in the main function before the gui is created.

    QSurfaceFormat format;

    Maybe this is needed so the UI and the QOpenGLWidget has the same version opengl contexts so they play nice. I'm not entirely sure what goes on the background.

Log in to reply