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. QGLWidget::updateGL not working on Windows
Forum Updated to NodeBB v4.3 + New Features

QGLWidget::updateGL not working on Windows

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 6.3k 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.
  • E Offline
    E Offline
    ecripes
    wrote on last edited by
    #1

    I recently compiled the newest version of Qt on Windows using Visual Studio compiler. I have a class that inherits QGLWidget. I have a loop which calls updateGL() on an object from that class. It works (refreshes the gl window) on mac, and worked on windows when I was using Qt Creator and minGW with a previous version of Qt. But now using Visual Studio compiler, and a newly compiled version of Qt, it does not refresh the opengl screen when I call that function. I did notice that it does refresh the screen when I alt-tab to a new window.

    I realize there could be loads of reasons why this is happening, but if anyone will help me find the source I would be eternally grateful. I know next to nothing about visual studio, windows, or compilers, and it looks like the problem has something to do with those(or maybe Qt implementation). Also, I should mention, I did add some boost(v. 1.44 on windows) objects, using asio, date_time, thread, and regex. I doubt it is causing the problem, but thought I should mention it.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jorj
      wrote on last edited by
      #2

      i seem to remember (but i'm not sure), that you should call update() on these classes, which internally calls the GL method... and shouldnt call the updateGL method yourself...

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ecripes
        wrote on last edited by
        #3

        I think you are thinking of paintGL, which shouldn't be called directly. The program worked fine for weeks while using qt creator, but after recompiling qt with microsoft nmake and using nmake to compile my app it is not working correctly. I had to add windows.h to my code for gl.h to work correctly (apparently gl.h on windows contains a bunch of preprocessor variables that are defined in windows.h), could this be causing the issue?

        1 Reply Last reply
        0
        • E Offline
          E Offline
          ecripes
          wrote on last edited by
          #4

          update() does work, but the qt tutorials use updateGL(), so I assume that is the proper way of doing it. The program is very choppy with update().

          Also, I found some very old articles where a thread was the issue. I am calling the updateGL() within a boost::thread, which I wasn't doing before. Though, again, it still works correctly on mac ppc.

          Anyone know more about this?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jorj
            wrote on last edited by
            #5

            Yes you are right about update, I re-read the docs. Without looking at some code I don't have any other ideas though, sorry.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              ecripes
              wrote on last edited by
              #6

              I changed the boost asio timer and thread back to the QTimer for the main loop. And updateGL is working correctly. I'm new to threads, and I'm guessing that had something to do with it, though the updateGL call was the only problem I noticed.

              Thanks for the help!, though instead of trying to hunt down the issue, I'm going back to the QTimer for the loop as it worked just fine.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                Franzk
                wrote on last edited by
                #7

                QWidgets and painting in threads is a big nono.

                "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

                http://www.catb.org/~esr/faqs/smart-questions.html

                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