matlab 2018b 在只有核显的机器上opengl报错的问题 X11GLXDrawableFactory

com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x37e10dfd, isOwner false, <4dd74231, 25b2e611>[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

解决办法如下:
I also ran into this issue on my Dell XPS 13 9360 which neither has a NVIDIA or AMD card, but an on-board intel graphics card.
I filed a bug report with MATHWORKS and they proposed two solutions:
Create a file with the name 'java.opts' in the directory where MATLAB is executed (for me this is in '/usr/local/MATLAB/R2020a/bin/glnxa64') with the following line: -Djogl.disable.openglarbcontext=1
If this does not work, then the above solution using export MESA_LOADER_DRIVER_OVERRIDE=i965 is working.
For me both solve my issue.

参考文献:
https://www.mathworks.com/matlabcentral/answers/392743-r2018a-glexception-error-on-linux

原文地址:https://www.cnblogs.com/zbqhc/p/13935817.html