Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Assign different QOpenGLWidget to unique threads to render?



  • Hi thanks for clicking into my post.

    Right now my Qt application has multiple QOpenGLWidget to render different stuff on the screen. The structure here is that a DataManager as a data center updating data per frame. And different QOpenGLWidget windows subscribe the data from the data center and render something to visualize the data like streaming (Use QTimer to update data and update() to call paintGL()). However I found it pretty slow. Like the frame rate is only 1 frame per second. I know there are some ways to improve rendering speed but I think multi-threading could also helps here.

    The problem is that I haven't wrote any real concurrent code before. I only know the concept, I have read through Qt5 Multithreading but still there are no examples provided to let me actually apply it to my projects.

    My scenario is just assign different QOpenGLWidgets running on different thread, and they could all acquire data from "DataManager". On the other hand, the main thread could control over its children (show(), hide(), or other information). I have drawn the structure below, (google drive link cannot be the source of image)
    An image on google drive

    Could someone give me a high level code example to apply my scenario here? Thanks in advance.

    System: Ubuntu16.04, Qt5.6.2, OpenGL3.3


  • Lifetime Qt Champion

    Hi,

    Did you already saw the suggestions in QOpenGLWidget's documentation threading part ?



  • @SGaist Thanks, it seems I have ignored this page you mentioned, I may look through it and get back when I got any progress.


Log in to reply