Cannot turn on overlay plane using OpenGL in Qt5



  • We are porting some C++ code from Visual Studio 2008/Qt4 to Visual Studio 2017/Qt5 and cannot turn on the overlay plane using OpenGL 4.5 with a NVIDIA Quadro graphics card. The same code is okay in VS2008/Qt4. Following is a small sample program.

    int main (int argc, char *argv[])
    {
        printf ("debug test1\n");
        QApplication a (argc, argv);
    
        QGLFormat glFmt;
        glFmt.setStereo (true);
        glFmt.setOverlay (true); 
        glFmt.setDoubleBuffer (true);
    
        QGLWidget *qtWid = new QGLWidget (glFmt);
        qtWid->show();
        printf ("version           %d.%d\n", qtWid->format().majorVersion(), qtWid->format().minorVersion());
        printf ("stereo            %d\n",    qtWid->format().stereo());
        printf ("hasOverlay        %d\n",    qtWid->format().hasOverlay());
        printf ("hasOpenGLOverlays %d\n",    qtWid->format().hasOpenGLOverlays());
        printf ("doubleBuffer      %d\n",    qtWid->format().doubleBuffer());
    
        return a.exec ();
    }
    

    In VS2017/Qt5, "hasOverlay" and "hasOpenGLOverlays" always return 0. In VS2008/Qt4 they return 1. The Quadro card has a hardware overlay plane and it is turned on in the NVIDIA Control Panel.

    Did OpenGL in QT5 stop supporting the hardware overlay plane?


  • Lifetime Qt Champion

    Hi,

    What exact version of Qt 5 are you using ?

    Note that QGLWidget has been deprecated in favour of QOpenGLWidget.



  • SGaist,
    Thank you for your reply. I'm using Qt 5.10.1.
    QOpenGLWidget does not appear to have the the set overlay and (or) get overlay functions that QGLWidget had. Am I missing something? I know the trend has moved toward frame buffers objects instead of using the overlay plane. I would like to keep the overlay plane for one of our 3D windows until we get this port complete.
    Thank you for your help,
    Mike



  • Wild guess (I don't have any hardware with true overlay planes handy to try it) but maybe you can set a default surface format before you create the QApplication object that will preserve your desired behavior. If Qt is internally setting up an OpenGL context before your QGLWidget is created, it may be screwing with things.

    I'd try a QSurfaceFormat::setDefaultFormat() with QSurfaceFormat::DeprecatedFunctions set to see if that helps pick up some of the previous behavior. There's nothing explicit in QSurfaceFormat documentation that mentions overlay planes, but you may be able to find some combination of flags that lights them back up. Maybe CompatibilityProfile will help.



  • @wrosecrans
    Wrosecrans,

    Thank you for your reply.

    I tried your first suggestion and the overlay plane was still being reported as off. I looked into QSurfaceFormat::DeprecatedFunctions and tried to see if the OpenGL context had the overlay plane turned on but with no luck. Either I'm using OpenGL context wrong or the hardware overlay plane is deprecated. The tell for me is in the QGL source code for the QGLFormat::hasOpenGLOverlays() function as shown below.

    bool QGLFormat::hasOpenGLOverlays()
    {
    return false;
    }

    The hard coded false makes me think that support for hardware overlays is deprecated in Qt although I can't seem to find any documentation that makes that statement.

    We thought there was a trend away from hardware overlays and towards frame buffer objects several years ago and we converted several of our other graphics drivers to use them. It looks like it's time to convert this last holdout and say goodbye to hardware overlays.

    Thank you for your help,
    Mike


  • Lifetime Qt Champion

    Before crossing that feature definitively, I'd recommend asking on the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.