Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

How do I direct MATLAB to use the Mesa OpenGL libraries or the system OpenGL libraries on a UNIX machine?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-17YM3
Product:   MATLAB
Reported in Release:   R11.1
Platform:   UNIX
Operating System:   UNIX Any
 

Subject:

How do I direct MATLAB to use the Mesa OpenGL libraries or the system OpenGL libraries on a UNIX machine?

Problem Description:

I would like to direct MATLAB to use the Mesa OpenGL libraries or the system OpenGL libraries on a UNIX machine.

Solution:

When searching for OpenGL libraries, MATLAB first looks on the system library path. If OpenGL is not found there, it uses the Mesa libraries shipped with MATLAB.

As of MATLAB 7.0.1 (R14SP1), if you want to use the MESA libraries, use the following command in MATLAB:
opengl software
If you are using a previous version of MATLAB, please read the following information:

If your system library path is defined, you must modify it in order for MATLAB to use the Mesa libraries. If you are not familiar with modifying environment variables, then you should consult your system administrator or system documentation for more information on modifying the library path.

Here is how to put the Mesa libraries at the head of the system library path:

 
setenv LD_LIBRARY_PATH $MATLAB/sys/opengl/lib/$ARCH:$LD_LIBRARY_PATH
PLEASE NOTE: $MATLAB should be replaced by your root MATLAB directory, and $ARCH should be replaced by your system architecture.

You can verify which OpenGL MATLAB is using by using the following command in MATLAB:
opengl info

If you want to use your system OpenGL libraries instead, you can determine the location of the libraries by consulting your system administrator or by referring to your system documentation. The OpenGL drivers will have a file name of libGL.$EXT and libGLU.$EXT (where $EXT is the platform's sharable library extension, e.g.. so, a, sl).

Here is an example for SOLARIS workstations:

If your OpenGL libraries are in /usr/lib and you are on SOLARIS then the following UNIX command will pre-append the directory to the library path.

setenv LD_LIBRARY_PATH /usr/lib:$LD_LIBRARY_PATH

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page