フィルターのクリア

OpenGL Rendering in Matlab R2024b on Ubuntu LTS 24.04 fails: com.jogamp​.opengl.GL​Exception: X11GLXDrawableFactory - Could not initialize shared resources for ...

383 ビュー (過去 30 日間)
Jani Jaakkola
Jani Jaakkola 2024 年 9 月 30 日
編集済み: Yoav 2024 年 10 月 15 日 6:06
This error message means that 3D accelerated OpenGL rendering does not work. On same hardware R2024a didn't even try OpenGL, so this is a new problem. This applies to R2024b running on Ubuntu LTS 24.04 on at least two different hardware. There are many more reports here of same errors on older Linux distrubitions with older Matlab versions and probably older hardware, with same workarounds. But it would be better if 3D acceleration worked out of the box with R2024b or at least get disabled by default, if there is a problem.
The whole error message is:
com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :1, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x134ee3b8, isOwner false, <590c7f9b, 33bfcb35>[count 0, qsz 0, owner <NULL>]]]
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:688)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:580)
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:297)
... 2 more
This happens at least on the following Intel GPUs:
  • Intel Corporation WhiskeyLake-U GT2 [UHD Graphics 620]
  • Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
A workaround is to disable 3D acceleration with 'matlab -softwareopengl'.
On a laptop which has both Nvidia and Intel GPU Matlab automatically disables 3D acceleration when you attempt to use the Nvidia GPU:
jjaakkol@lx4-fuxi0:~$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia matlab
MATLAB is selecting SOFTWARE rendering.
However if you force 3D rendering on the nvidia GPU, it seems to work fine:
jjaakkol@lx4-fuxi0:~$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia matlab -nosoftwareopengl -nodesktop
< M A T L A B (R) >
Copyright 1984-2024 The MathWorks, Inc.
R2024b (24.2.0.2712019) 64-bit (glnxa64)
August 22, 2024
To get started, type doc.
For product information, visit www.mathworks.com.
Warning: OpenGL Startup options will be removed in a future release.
>> rendererinfo
ans =
struct with fields:
GraphicsRenderer: 'OpenGL Hardware'
Vendor: 'NVIDIA Corporation'
Version: '4.6.0 NVIDIA 555.42.06'
RendererDevice: 'NVIDIA RTX 2000 Ada Generation Laptop GPU/PCIe/SSE2'
Details: [1x1 struct]
>>

回答 (1 件)

Himanshu
Himanshu 2024 年 10 月 4 日
Hello,
I see that you are trying to resolve a 3D accelerated OpenGL rendering issue with MATLAB R2024b on Ubuntu LTS 24.04, which didn't occur in MATLAB R2024a.
You can follow the below steps to resolve this issue:
1) Executing the following command in a Linux Shell to start MATLAB. This command instructs MATLAB to only use software OpenGL libraries.
$ matlab -softwareopengl
2) Create a file with the name 'java.opts' in the directory where MATLAB is executed, containing the line:
-Djogl.disable.openglarbcontext=1
Then start MATLAB and everything should work as expected.
Please refer to the below documentation for more information.
Start MATLAB program from Linux system prompt: https://www.mathworks.com/help/matlab/ref/matlablinux.html
I hope this helps.
  2 件のコメント
Jani Jaakkola
Jani Jaakkola 2024 年 10 月 14 日 10:20
This looks like a AI generated answer. The problem/bug is that 3D accerelation does not work and the flag -softwaregl just disables 3D acceleration, so that Matlab starts.
Yoav
Yoav 2024 年 10 月 15 日 6:05
編集済み: Yoav 2024 年 10 月 15 日 6:06
The 2nd step is a copy of this (Willi Mutschler's) answer, although a bit clearer IMO. When using the linked solution I missed the '-' at the beggining of the fix and it didn't work for me.
Is it possible to amend the old one to be a bit clearer and just link it?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by