Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-124509

QSurfaceFormat::setDefaultFormat is ignored of new QOpenGlContext is created

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.2
    • GUI: OpenGL
    • None
    • Windows 11, Qt 6.5.2, Nvidia Quadro 2000
    • Windows

    Description

      QSurfaceFormat::setDefaultFormat value (at least the multi-sampling part) is forgotten after re-parenting an QOpenGLWidget. This can be reproduced, using the hellogl2 example. We modified the example and hardcoded a multisampling value of 4:

       fmt.setSamples(4); // hardcode multisampling for bug report
       QSurfaceFormat::setDefaultFormat(fmt);
      

      The source code is available here:

      https://github.com/githubuser0xFFFF/qt_bugreport_hellogl2/commit/9bbee939fd093aed5a02f445f389e5dd2f0fc207

      After start of the example, the multisampling works like expected:

      After Undock-Dock cycle, the multisampling is broken:

      So application that use docking systems such as the Qt Advanced Docking System where widgets are reparented will see this issue. We use the Qt Advanced Docking System with the coin3d library and see this issue. In Qt5 this works properly using the following code

      #if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
      	QGLFormat format;
      	format.setAlpha(true);
      	format.setSampleBuffers(true);
      	QGLFormat::setDefaultFormat(format);
      #else
      

      For the hellogl2 example we implemented a work around hack - you can get it here:

      https://github.com/githubuser0xFFFF/qt_bugreport_hellogl2/commit/4b6ac8ca95105efa86669c3fff4ebef36ba3b785

      I think, the bug is related or the same like this one: QTBUG-59152

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lagocs Laszlo Agocs
            ukindler Uwe Kindler
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes