Tue, 04/27/2021 - 15:47
Hello everyone,
I recently came across a graphics problem, when I tried to run my linux application with Qt (5.15) and OpenCASCASE (7.4) on a Windows-10 system inside the Windows Subsystem for Linux (WSL) system.
I create the viewer widget very much like in the OCC C++ sample. This works very nicely in Linux. In Windows/WSL on the other hand, I see a lot of artifacts. Not in the OCC viewer. The image there is without errors. But everywhere across the other Qt-controls and widgets nasty rectangular black artifacts appear.
In the WSL X-server I have disabled native OpenGL and software rendering is used:
$ glxinfo -B
name of display: localhost:0
display: localhost:0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: VMware, Inc. (0xffffffff)
Device: llvmpipe (LLVM 10.0.0, 256 bits) (0xffffffff)
Version: 20.0.8
Accelerated: no
Video memory: 2047MB
Unified memory: no
Preferred profile: core (0x1)
Max core profile version: 3.3
Max compat profile version: 3.1
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.1
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 10.0.0, 256 bits)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 20.0.8
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profileOpenGL version string: 3.1 Mesa 20.0.8
OpenGL shading language version string: 1.40
OpenGL context flags: (none)OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.0.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
on the linux machine:
$ glxinfo -B
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 2048 MB
Total available memory: 2048 MB
Currently available dedicated video memory: 1108 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Quadro M600M/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 460.73.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profileOpenGL version string: 4.6.0 NVIDIA 460.73.01
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 460.73.01
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
I'm a bit lost about how to proceed in this case. Do you have any hints what to attempt to remove these artifacts?
Note: I have also used programs with VTK-9 (paraview) in this environment and works without artifacts.
Thanks for any hints and
Regards, Hannes
Tue, 04/27/2021 - 15:49
and here is a little minimum example
Tue, 04/27/2021 - 17:36
Don't know where to look at, just curious if the same problem occurs when using other X-servers - like remote connection to a real Linux workstation or using WSLg (the latter requires Windows 10 Insiders preview build 21364 or higher and pretends to provide GPU-accelerated OpenGL experience, although I would expect it to be castrated, as it is implemented using DirectX drivers).
Wed, 04/28/2021 - 13:41
Hi Kirill,
thanks for your feedback.
I tried other X-servers which I could access: Xming, MobaXterm with various settings, but without difference (Probably these implementations are too similar).
Also, I run my Linux version through a SSH tunnel with the DISPLAY directed to VcXsrv. It shows the same behaviour.
WSLg seems a little experimental(?) I did not find the time to test this.
So what I actually look for is a workaround to make things run in VcXsrv. Performance is not an issue. As I understood (maybe wrong, I'im not very experienced in OpenGL programming), Qt uses the current context to draw things. Maybe either Qt or OCC does something, which makes it invalid. I stumbled across a QPainter::beginNativePainting() function which I guess is there to handle some shared usage of contexts. Maybe this should be applied somehow.
Regards, Hannes
Thu, 04/29/2021 - 11:25
Sorry, I don't know much how Qt works underhood.
I guess (unlike QtQuick) Qt Widgets don't use OpenGL for rendering, so I don't quite understand how OpenGL state may affect Qt rendering at all.
Thu, 04/29/2021 - 12:18
Ok, thanks for your comments anyway.
Maybe it has nothing to do with OpenGL at all. This was just my first assumption. I will investigate further...
Thu, 04/29/2021 - 10:41
By the way: I can also replicate the problem on my linux machine only by directing the display output through an SSH-connection to localhost:
ssh -X localhost
and then run my test app. The artifacts appear as well.