How to activate openGL in MATLAB on Linux if you have problems
55 views (last 30 days)
Show older comments
It took me a long time to get it, so I'll put you here in case it helps how I managed to activate openGL in Linux:
1) If you haven't already (it's common for other problems), rename libstdc++ library from MATLAB:
`mv _YOUR_MATLAB_ROOT_FOLDER_/sys/os/glnxa64/libstdc++.so.6 _YOUR_MATLAB_ROOT_FOLDER_/sys/os/glnxa64/libstdc++.so.6.bak`
2) Create this link: `sudo ln -s /usr/lib/x86_64-linux-gnu/dri/ /usr/lib/`
3) Run `export MESA_LOADER_DRIVER_OVERRIDE=YOUR_DRI_DRIVER;matlab -desktop -nosoftwareopeng`
Your DRI Driver will be a file from `/usr/lib/dri`, removing "_dri" (in my case was the "radeons" driver for an AMD Vega graphic card.
4) Run MATLAB from a terminal using: `export MESA_LOADER_DRIVER_OVERRIDE=_YOUR_DRIVER_HERE_;matlab -desktop -nosoftwareopengl`. _YOUR_DRIVER_HERE_ should be your driver, radeonsi in my case.
5) Check openGL in MATLAB with `info = rendererinfo`
6) If something went wrong, you will be able to see in the terminal which library was responsible. Executing 4) and 5) I was discovering what I had to correct, you can do the same if you have another problem that has not appeared to me.
So that it always runs correctly I put `export MESA_LOADER_DRIVER_OVERRIDE=YOUR_DRI_DRIVER` at the beginning of the script that runs matlab (_YOUR_MATLAB_FOLDER/bin/matlab), although I suppose it can also be set as an environment variable.
I don't know if any of the paths might change depending on which version of Linux or MATLAB you're using, but you can follow the procedure above to find out what libraries you need and where they should be. In my case I used Linux Mint and MATLAB 2022b.
I hope this has been useful to you.
0 Comments
Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!