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. OpenGL Dynamic selected driver
Forum Updated to NodeBB v4.3 + New Features

OpenGL Dynamic selected driver

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.8k Views 1 Watching
  • 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.
  • Q Offline
    Q Offline
    QbProg
    wrote on last edited by
    #1

    Hello,
    is there a way to detect the current opengl implementation used between desktop , angle, software?
    I see a way to force the selection (using attributes), but not a direct way to detected the selected implementation.

    I would like to detect if I'm using desktop opengl because I need to workaround the fullscreen + dialogs bug.

    Thank you
    QbProg

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ceora
      wrote on last edited by
      #2

      If you are using QCoreApplication or QApplication, you can testit like this

      @QCoreApplication a(argc,argv);//in main

      bool test = a.testAttribute(Qt::AA_UseDesktopOpenGL);

      //or somewhere else in the code:
      bool test = qApp->testAttribute(Qt::AA_UseDesktopOpenGL);
      @

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        QbProg
        wrote on last edited by
        #3

        unfortunately that doesn't seem to work, as these flags are used to force the loading behavior, but when you read them they are always false (of course with a QML scene already loaded).

        1 Reply Last reply
        0
        • C Offline
          C Offline
          ceora
          wrote on last edited by
          #4

          Strange, for me work(I don't use QML)... Which version of Qt do you have??
          using this piece of code it give me true on test:

          @
          #include <QApplication>
          #include <QOpenGLWidget>
          int main(int argc, char *argv[])
          {
          QApplication a(argc, argv);
          a.setAttribute(Qt::AA_UseDesktopOpenGL);

          QSurfaceFormat fmt;
          fmt.setDepthBufferSize(24);
          fmt.setVersion(3, 2);
          fmt.setProfile(QSurfaceFormat::CoreProfile);

          QSurfaceFormat::setDefaultFormat(fmt);

          bool test = a.testAttribute(Qt::AA_UseDesktopOpenGL);
          QOpenGLWidget w;
          w.show();

          return a.exec();
          }@

          play with commenting , uncommenting the line with setAttribute, test give tru if the line is uncommented, false if is commented, as expected.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            agocs
            wrote on last edited by
            #5

            Query format() from the QOpenGLContext after create(). Then check renderableType() to differentiate between OpenGL and OpenGL ES (ANGLE).

            As for differentiating between (non-ANGLE) OpenGL implementations, it's more tricky since there's no difference from Qt's point of view. However, you can still query strings like GL_RENDERER and look for "llvmpipe".

            The example qtbase/examples/opengl/contextinfo may be a useful tool and reference for doing such checks.

            1 Reply Last reply
            1

            • Login

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