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. Graphics artifacts in X11 with OpenGL software rendering
Forum Updated to NodeBB v4.3 + New Features

Graphics artifacts in X11 with OpenGL software rendering

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 724 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.
  • H Offline
    H Offline
    Hannes Kroeger
    wrote on 29 Apr 2021, 07:19 last edited by
    #1

    Hi everyone,
    I came across a weird problem and I'm currently a bit lost about how to find a workaround. Maybe someone here has a hint about how to proceed.

    My project so far:

    • a Qt-5 GUI (Qt 5.15) written in C++ for Linux (Ubuntu 20LTS) with several controls in the main window
    • the application links an external library (OpenCASCADE CAD kernel, OCC) and embeds OCC'S OpenGL Viewer in a dedicated widget. The OCC viewer is embedded in a Qt Widget, which set the flags Qt::WA_NoSystemBackground and Qt::WA_PaintOnScreen and returns a nullptr paintEngine, so merely acts as a frame for the external viewer.

    This works nicely in Linux without problems.

    Now, I want to run the application in Windows-10's WSL system with a VcXsrc as X-Server and Mesa software rendering.

    Actually this kind of works also. The OpenGL viewer shows its image without errors. But the other Qt controls (especially QTextEdit and QLineEdit type controls) all get deteriorated with black rectangle artifacts when the window is resized or redrawn.
    When the OCC Viewer widget is removed, the artifacts are gone also.
    Obviously there is kind of an interference between the external OpenGL widget and Qt.

    I tried some other X-Servers for Windows (Xming, MobaXterm) but all showed the same problem. Interestingly, when I log into the Linux machine and direct the X output to the windows host, I also see the artifacts in the output of the Linux application).

    As said, I'm looking for a workaround but I'm not sure where to look for the reason. How does Qt use OpenGL for a plain desktop application? Is there a way to revert to some kind of legacy drawing of the controls and widget contents?

    Thanks for any hint.

    Regards, Hannes

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gde23
      wrote on 29 Apr 2021, 08:21 last edited by
      #2

      Two ideas what could help although its just a guess.
      Try setting QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
      somewhere in your main() fuction.

      Another idea that could help is, if there are any functions in your OpenGL widget that get called from outside and change opengl stuff to add QOpenGLWidget::makeCurrent(); at the begin of the function. However since your using the viewer from the OCCT library I guess you do not want to change anything in the lib.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hannes Kroeger
        wrote on 29 Apr 2021, 09:54 last edited by Hannes Kroeger
        #3

        Hi gde23,

        thanks for your comments!

        I tried your first guess, but that did not change anything.

        BTW, I'm no longer sure that the OpenGL viewer is actually causing the trouble. My impression is, that the flags of the container widget is causing issues.
        I did a quick test and removed all the external calls to OCC so that just an empty widget with
        setMouseTracking( true );
        setBackgroundRole( QPalette::NoRole );
        setAttribute( Qt::WA_NoSystemBackground );
        setAttribute( Qt::WA_PaintOnScreen );
        is left.
        And: the problem is still there.
        It's only disappearing, if I remove the WA_PaintOnScreen flag.
        Unfortunately, if I re-enable all the OpenGL viewer stuff with WA_PaintOnScreen unset, the problem is there again...

        1 Reply Last reply
        0

        1/3

        29 Apr 2021, 07:19

        • Login

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