Sunday, October 21, 2007

How to fix the "Warning: Unable to load the OpenGL" error in Matlab

If you use Matlab in K/Ubuntu and you get a warning message like "Warning: Unable to load the OpenGL" everytime you start Matlab it means you are not using the powerful OpenGL rendering engine to draw your plots.

This may not be a big problem as Matlab will work as expected but if you have a 3D accelated graphics card (ATI or NVidia) then you could greatly benefit from having Matlab use the OpenGL renderer. Even without a 3D accelerated graphics card I would say that using OpenGL for rendering is a plus.

So solve this problem you simply need to remove a file (libgcc_s.so.1) from the Matlab install directory in order for it to use the one in the system that has correct links to the OpenGL libraries.

Find the file inside $MATHROOT/sys/os/glnx86 and move it to another place like:

mv libgcc_s.so.1 libgcc_s.so.1.old

Restart Matlab and the warning message should have dissapeared and the command "opengl info" should give and output like:

Version = 2.0.6473 (8.37.6)
Vendor = ATI Technologies Inc.
Renderer = ATI MOBILITY FireGL V3200
MaxTextureSize = 2048
Visual = 0x29 (TrueColor, depth 24, RGB mask 0xff0000 0xff00 0x00ff)
...

The output may vary depending on your graphics card or if you have accelerated or non-accelerated (i.e. Mesa) OpenGL graphics.

No comments:

Post a Comment