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. Threaded OpenGL rendering, multiple QOpenGLWidgets with same parent

Threaded OpenGL rendering, multiple QOpenGLWidgets with same parent

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 662 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.
  • S Offline
    S Offline
    sylorr
    wrote on 4 Jan 2019, 18:55 last edited by aha_1980 1 May 2019, 09:28
    #1

    Hi all, I have several rendering tasks that wanna rendering in different widgets.

    I have created a base rendering class that inherits from QOpenGLWidget. Every of my rendering window/widget inherits from my base render class. In my class I manually manage a QThread and move my renderer tasks (all gl functions) in to this thread and grab the context() from UI thread. And call my class's "update" function by "InvokeMethod" with QueuedConnection.
    By doing this, I could render and update my render content in different thread.

    class GLView;
    class GLRenderer;
    
    GLRenderer::draw() {
        // move context() into QThread thread
        // gl function calls
        QMetaObject::InvokeMethod(glview_, "update");
    }
    

    These rendering widgets works perpectly, renders smoothly when they have DIFFERENT parents. However, when putting them on the same QMainWindow(as parent), one of my rendering window starts to flicker.

    I have double checked that the rendering threads are different. I know parent thing in Qt may affect an object's lifetime (parent is responsible for releasing its children). But any other differences that cause my issue here? Any idea?

    Platform: Qt5.6, Ubuntu16.04

    Update
    I simple inference would be "Event Loop". Since QueuedConnection may delay an update() call, which means my rendering task is scheduled to be delayed. It's reasonable that every individual window in Qt may have its own Event Loop. And when I attach all my rendering window on same parent, I have scheduled too many update() call which causes flickering in rendering.

    1 Reply Last reply
    0

    1/1

    4 Jan 2019, 18:55

    • Login

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