Technical Solutions
Why does my Linux hardware OpenGL not work properly?
Date Last Modified: Friday, June 26, 2009
| Solution ID: | 1-18N21 | |
| Product: | MATLAB | |
| Reported in Release: | R12 | |
| Fixed in Release: | R14SP2 | |
| Platform: | All Platforms | |
| Operating System: | All OS |
Subject:
Why does my Linux hardware OpenGL not work properly?
Problem Description:
I would like to know why the patches of my surface are rendered in the wrong order.
I also receive a warning when I try to use OpenGL in Linux.
Calling any 3-D plotting commands results in the following error:
Warning: OpenGL not available. Using ZBuffer.
> In $MATLAB/toolbox/matlab/graphics/opengl.m at line 47
I also receive this error when I type
opengl info
This issue has been observed most commonly with NVIDIA drivers on Linux.
Solution:This enhancement has been incorporated in Release 14 Service Pack 2 (R14SP2). For previous product releases, read below for any possible workarounds: or You can get the correct version of these libraries by setting up MATLAB to use your native Linux "libGL.so" file and the generic "libGLU.so" file that is shipped with MATLAB in the $MATLABROOT/sys/opengl/lib/glnx86 directory (where $MATLAB is the root MATLAB directory). Consult your system documentation to identify the location of your native Linux OpenGL libraries. They are files or symbolic links called "libGL.so" and they are usually located in a directory such as /usr/lib or a similar directory. This native library may indicate Mesa software OpenGL, or may indicate a library that is specifically accelerated for your hardware. Later in this resolution, you will see how to determine which MATLAB is using. Once you have identified these libraries, for example: you can create symbolic links in some_directory to these respective libraries using the UNIX linking utility. For example, assuming your native OpenGL Linux library "libGL.so" is located in /usr/lib and your MATLAB is installed in /usr/matlab, you would then do something such as this: Next you must add some_directory to your library path so that MATLAB will find it first: You can verify which OpenGL library file MATLAB is using by using the "ldd" command: You can verify which renderer the libraries actually indicate by using the following command in MATLAB:
opengl info
If MATLAB is using the Mesa software OpenGL, then you should see the following output for MATLAB 6.0 (R12) and later versions:If MATLAB is using hardware, then you will see different output, such as the following: The "Renderer" line will indicate whether you are using software or hardware. In the example above, G400 indicates the graphics card that is being used. Determining what your own machine is using may require some investigation. If you are still experiencing difficulties, such as incorrectly sorted surface patches or error messages, then most likely MATLAB is not using the appropriate XVisual for figure OpenGL graphics. To resolve that problem, follow these instructions: First verify that you are using hardware OpenGL by obtaining information using the "opengl info" MATLAB command as discussed above. After you have determined what you are using for hardware, check which XVisual your MATLAB figure is using. You can use the following MATLAB commands:
hf=figure;
Now cross-reference this number against the output of the UNIX command, glxinfo:
!glxinfo
You can see that a visual id of 0x23 has a depth ("dp th") of 0. This indicates that the patches do not get rendered in the proper order. The renderer is not paying attention to their depth within the monitor. To fix this, choose the best TrueColor visual that has a depth and that has double buffering. A TrueColor visual has a "visual cl" value of "tc", and a double buffering visual has a "d b" value of "y". In this case visual 0x25 has TrueColor, double buffering, 24bit Zbuffer ("bfsz"), and is not "slow". The following code shows how to set this visual to all MATLAB figures. You may wish to put this line of code in a "startup.m" file:
set(0,'defaultfigurexvisual','0x25');
For more information on "startup.m" files, see the following online documentation:http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f8-4994.html |
Related Solutions:
|
|
Store

