Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGL on Mac - QCocoaGLContext: Falling back to unshared context
QtWS25 Last Chance

QOpenGL on Mac - QCocoaGLContext: Falling back to unshared context

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 2.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • njbrownN Offline
    njbrownN Offline
    njbrown
    wrote on last edited by
    #1

    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:
    https://github.com/jahshaka/VR

    Thanks in advance.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      200% mac noob but it seems to come from

      http://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/cocoa/qcocoaglcontext.mm

      // 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?

      https://forum.qt.io/topic/70082/qt-5-7-opengl-core-profile-2-1-on-os-x-functions-don-t-work

      1 Reply Last reply
      2
      • njbrownN Offline
        njbrownN Offline
        njbrown
        wrote on last edited by
        #3

        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;
        format.setDepthBufferSize(32);
        format.setMajorVersion(3);
        format.setMinorVersion(2);
        format.setProfile(QSurfaceFormat::CoreProfile);
        
        QSurfaceFormat::setDefaultFormat(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.

        1 Reply Last reply
        5

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved