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. QOpenGLWidget VSync
QtWS25 Last Chance

QOpenGLWidget VSync

Scheduled Pinned Locked Moved Unsolved General and Desktop
qopenglcontextvsyncframerateopengl
24 Posts 6 Posters 7.5k 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.
  • R Offline
    R Offline
    rtavakko
    wrote on 23 Feb 2020, 16:29 last edited by
    #7

    Any thoughts on this guys? I've verified the same thing on my machine with various QT OpenGL examples. The top level windows divide the refresh rate between them. If I have two QMainWindows for example, each will render at 30 fps with the default 60 Hz refresh rate. Each one can have many child widgets all running at the same 30 fps rate.

    I have a feeling I will need to create a context for each top level window. Any thoughts on how and where (in main?) to do this. Does the top level window need to be a QWindow for this to work?

    Cheers!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcleary
      wrote on 24 Feb 2020, 19:40 last edited by
      #8

      Unfortunately I also don't know how to proceed and would need to see the application. Could you share one of the examples you mentioned?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rtavakko
        wrote on 25 Feb 2020, 00:53 last edited by
        #9

        Sure. I modified the qopenglwindow and qopenglwidget example adding an extra window. Qopenglwidget is easier to do since it displays framerate and also you can add child widgets on the fly.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcleary
          wrote on 25 Feb 2020, 10:22 last edited by
          #10

          I'll see if I can try it today. Will report back.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mcleary
            wrote on 25 Feb 2020, 19:19 last edited by mcleary
            #11

            Is it that what you're talking about? As you can see, all widgets are running at 60fps.

            Capture.PNG

            R 1 Reply Last reply 25 Feb 2020, 20:43
            1
            • M mcleary
              25 Feb 2020, 19:19

              Is it that what you're talking about? As you can see, all widgets are running at 60fps.

              Capture.PNG

              R Offline
              R Offline
              rtavakko
              wrote on 25 Feb 2020, 20:43 last edited by rtavakko
              #12

              @mcleary Thanks for trying it, thats exactly it! I added a second top level window in main and that caused the framerate for both winows and their child widgets to be divided in half.

              I just finished modifying the contextinfo example also creating two RenderWindow objects contained by two QWidgets in a single window and the two render at the correct 60 Hz refresh rate since each has a separate context. I think that's what I'll need to do but I'm not sure if this just my machine or its Windows or its just the way it is overall.

              M 1 Reply Last reply 26 Feb 2020, 10:10
              0
              • R rtavakko
                25 Feb 2020, 20:43

                @mcleary Thanks for trying it, thats exactly it! I added a second top level window in main and that caused the framerate for both winows and their child widgets to be divided in half.

                I just finished modifying the contextinfo example also creating two RenderWindow objects contained by two QWidgets in a single window and the two render at the correct 60 Hz refresh rate since each has a separate context. I think that's what I'll need to do but I'm not sure if this just my machine or its Windows or its just the way it is overall.

                M Offline
                M Offline
                mcleary
                wrote on 26 Feb 2020, 10:10 last edited by
                #13

                @rtavakko I also tried creating a new top level window but I still have no problems. Hopefully you can find the problem

                R 1 Reply Last reply 26 Feb 2020, 16:07
                0
                • M mcleary
                  26 Feb 2020, 10:10

                  @rtavakko I also tried creating a new top level window but I still have no problems. Hopefully you can find the problem

                  R Offline
                  R Offline
                  rtavakko
                  wrote on 26 Feb 2020, 16:07 last edited by rtavakko
                  #14

                  @mcleary Thanks again for trying it! I also ran the same code with two top level widgets on another PC and it worked ok so I'm guessing this is something with my laptop. I'm not sure if its still recommended to give each OpenGL widget its own context to make sure the code runs the same way on different PCs.

                  M 1 Reply Last reply 27 Feb 2020, 09:26
                  0
                  • R rtavakko
                    26 Feb 2020, 16:07

                    @mcleary Thanks again for trying it! I also ran the same code with two top level widgets on another PC and it worked ok so I'm guessing this is something with my laptop. I'm not sure if its still recommended to give each OpenGL widget its own context to make sure the code runs the same way on different PCs.

                    M Offline
                    M Offline
                    mcleary
                    wrote on 27 Feb 2020, 09:26 last edited by
                    #15

                    @rtavakko If you absolutely need to share the contexts then I guess you should try to find the problem with your laptop. Which graphics processor do you have on the laptop? Is the driver updated?

                    R 1 Reply Last reply 27 Feb 2020, 11:28
                    0
                    • M mcleary
                      27 Feb 2020, 09:26

                      @rtavakko If you absolutely need to share the contexts then I guess you should try to find the problem with your laptop. Which graphics processor do you have on the laptop? Is the driver updated?

                      R Offline
                      R Offline
                      rtavakko
                      wrote on 27 Feb 2020, 11:28 last edited by
                      #16

                      @mcleary Good point. I updated the drivers recently (about a month ago). My laptop specs are:

                      GPU: GeForce GTX 950M
                      OS + Driver: Windows 10, driver NVIDIA 4.5.0 385.54
                      Qt version: 5.12.0 MINGW (64 bit)

                      I also have an Intel HD Graphics 530 (NVIDIA Optimus tech) for the built-in display which may have something to do with this. I've set my GTX 950M for OpenGL rendering and as the high-performance card. I'll dig a little deeper to see what could be the issue and update the thread.

                      M 1 Reply Last reply 27 Feb 2020, 11:39
                      0
                      • R rtavakko
                        27 Feb 2020, 11:28

                        @mcleary Good point. I updated the drivers recently (about a month ago). My laptop specs are:

                        GPU: GeForce GTX 950M
                        OS + Driver: Windows 10, driver NVIDIA 4.5.0 385.54
                        Qt version: 5.12.0 MINGW (64 bit)

                        I also have an Intel HD Graphics 530 (NVIDIA Optimus tech) for the built-in display which may have something to do with this. I've set my GTX 950M for OpenGL rendering and as the high-performance card. I'll dig a little deeper to see what could be the issue and update the thread.

                        M Offline
                        M Offline
                        mcleary
                        wrote on 27 Feb 2020, 11:39 last edited by
                        #17

                        @rtavakko You could also try the MSVC build of Qt. I don't know if you are willing to install Visual Studio just to test this but it might be worth a shot.

                        R 1 Reply Last reply 27 Feb 2020, 16:09
                        0
                        • M mcleary
                          27 Feb 2020, 11:39

                          @rtavakko You could also try the MSVC build of Qt. I don't know if you are willing to install Visual Studio just to test this but it might be worth a shot.

                          R Offline
                          R Offline
                          rtavakko
                          wrote on 27 Feb 2020, 16:09 last edited by
                          #18

                          @mcleary I tried the QT MSVC 2017 compiler with the same results. My Optimus setup has betrayed me before...

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            Patterson
                            wrote on 9 Mar 2020, 08:26 last edited by Patterson 3 Nov 2020, 08:53
                            #19

                            Could you provide more details of your issue, such as screenshot of FPS, Monitor type, and the application you run. Note there are a set of applications can override v-sync settings in-app McDVOICE

                            R 1 Reply Last reply 9 Jun 2020, 00:55
                            0
                            • P Patterson
                              9 Mar 2020, 08:26

                              Could you provide more details of your issue, such as screenshot of FPS, Monitor type, and the application you run. Note there are a set of applications can override v-sync settings in-app McDVOICE

                              R Offline
                              R Offline
                              rtavakko
                              wrote on 9 Jun 2020, 00:55 last edited by
                              #20

                              @Patterson sure, I will get more details on this and post here

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                riyana
                                Banned
                                wrote on 19 Dec 2020, 08:26 last edited by
                                #21
                                This post is deleted!
                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  rtavakko
                                  wrote on 13 Jan 2021, 21:05 last edited by
                                  #22

                                  @mcleary @Patterson

                                  Its been a long time since this thread was started but I think it makes sense to post the updates here. I put together a basic project with native OpenGL and also using Qt's QOffscreenSurface and QWindow classes.

                                  The github repository can be found here:

                                  https://github.com/rtavakko/VSync

                                  In this setup there is a single renderer that render to an FBO texture using its own thread and 3 display windows that share the GUI thread with all of them sharing OpenGL contexts together.

                                  On my machine I see a clear lag with VSync on when there are 2 or more display windows. Turning VSync off clears the lag. The calcualted FPS values do not indicate any issues in either case which doesn't help but I see a clear difference when I start the application with say 2 displays and then close one of them.

                                  I have my internal laptop display and an RCA RT1970 (both running at 1920x1080 - 60Hz) and both connected to my integrated Intel HD 530 GPU. My discrete GPU is an NVIDIA GeForce GTX 950M and I'm running Qt 5.12.0 MSVC2017 64 bit.

                                  I'll dig in further myself also with other machines but if anyone has any ideas on what could be causing this, it would really help debug further.

                                  Cheers!

                                  1 Reply Last reply
                                  1
                                  • Mylincoln PortalM Offline
                                    Mylincoln PortalM Offline
                                    Mylincoln Portal
                                    Banned
                                    wrote on 24 Sept 2021, 08:13 last edited by
                                    #23
                                    This post is deleted!
                                    1 Reply Last reply
                                    0
                                    • L Offline
                                      L Offline
                                      liamerickson
                                      Banned
                                      wrote on 4 Feb 2022, 11:22 last edited by liamerickson 2 Apr 2022, 11:23
                                      #24
                                      This post is deleted!
                                      1 Reply Last reply
                                      0

                                      • Login

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