Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Detect OpenGL version before creating QApplication?
QtWS25 Last Chance

Detect OpenGL version before creating QApplication?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 674 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.
  • F Offline
    F Offline
    fcarney
    wrote on 14 Dec 2022, 00:04 last edited by
    #1

    Platform: Windows 10
    Qt: 5.12.10

    I just had to fix a stupid bug in my app that was causing it to not draw things correctly on a customer's computer. It turns out they by policy only have drivers for Vulkan and DirectX on their Windows 10 machines. They had absolutely zero drivers for opengl. So the application was starting and using Microsoft's opengl 1.1. QML requires a minimum of opengl 2.1 last I checked. So I forced the app to use ANGLE at the start. I also added command line options to choose opengl if needed. (In case someone somewhere doesn't have directx 9/11 installed. )

    Why would Qt select a version of opengl that doesn't meet minimum requirements? Shouldn't it default to angle in this case?

    I will have to research this a bit. Maybe 5.15 fixes this issue. I am not readily seeing a way to check opengl version either.

    C++ is a perfectly valid school of magic.

    D 1 Reply Last reply 14 Dec 2022, 00:15
    0
    • F fcarney
      14 Dec 2022, 00:04

      Platform: Windows 10
      Qt: 5.12.10

      I just had to fix a stupid bug in my app that was causing it to not draw things correctly on a customer's computer. It turns out they by policy only have drivers for Vulkan and DirectX on their Windows 10 machines. They had absolutely zero drivers for opengl. So the application was starting and using Microsoft's opengl 1.1. QML requires a minimum of opengl 2.1 last I checked. So I forced the app to use ANGLE at the start. I also added command line options to choose opengl if needed. (In case someone somewhere doesn't have directx 9/11 installed. )

      Why would Qt select a version of opengl that doesn't meet minimum requirements? Shouldn't it default to angle in this case?

      I will have to research this a bit. Maybe 5.15 fixes this issue. I am not readily seeing a way to check opengl version either.

      D Offline
      D Offline
      DerReisende
      wrote on 14 Dec 2022, 00:15 last edited by
      #2

      @fcarney You might be able to use glGetString(GL_VERSION)from Gl.h to get some sort of version info (see doc).

      1 Reply Last reply
      1
      • F Offline
        F Offline
        fcarney
        wrote on 14 Dec 2022, 16:36 last edited by fcarney
        #3

        @DerReisende said in Detect OpenGL version before creating QApplication?:

        glGetString

        This led me to this topic:
        https://forum.qt.io/topic/64503/qopenglfunctions-glgetstring-gl_extensions-is-null/16

        I ended up creating the QApplication, a surface, and a context. Then I check the version. Then I delete the app and the surface and force the attribute to use ANGLE if the opengl version is too low (<2.1). Then I recreate the QApplication.

        C++ is a perfectly valid school of magic.

        1 Reply Last reply
        0

        3/3

        14 Dec 2022, 16:36

        • Login

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