MATLAB: Does MATLAB 7.11 (R2010b) on a 64-bit Linux computer crash X-Windows when I execute the SURF command

driverMATLABvideo

When I use the SURF command in Linux 64-bit, the X Windows system crashes (the OS does not crash), the screen goes blank, and it quickly logs me out.
Example of the code to reproduce the issue:
for ii=1:10
close all
[x,y,z] = sphere ;
sh = surf( x, y, z ) ;
pause(1)
end

Best Answer

The issue is that the OpenGL renderer for graphics in MATLAB may not work. There are a few workarounds and recommendations:
Before you begin, update the graphics driver to the latest version.
The first option is to change the OpenGL rendering mode to software with the following command, either before executing SURF or in 'startup.m'.:
opengl software;
If this does not resolve the issue, the second option is to try turning off the OpenGL renderer completely. Note that this will disable alpha transparency.
opengl neverselect;
Another option is to force a particular renderer by default, by using the following command:
% choose ZBUFFER renderer
set(0,'defaultFigureRenderer','zbuffer');
% alternatively, choose PAINTERS renderer
set(0,'defaultFigureRenderer','painters');