MATLAB: Does MATLAB 7.7 (R2008b) crash when using the MESH command over an X connection

3dMATLABopenglpaintersplotrendererrenderersterminalxxtermzbuffer

I run the code below on a remote MATLAB session:
[x,y,z] = peaks;
for i = 1:20
close all;
figure;
mesh(x,y,z);
drawnow;
end;
The MATLAB session always crashes and disappears after a few iterations. Here is the crash dump:
Operating System: Linux 2.6.18-92.1.10.el5 #1 SMP Wed Jul 23 03:56:11 EDT 2008 x86_64
Processor ID: x86 Family 15 Model 1 Stepping 3, AuthenticAMD
Host Name: dav-dhcp-157-136.CE.Berkeley.EDU
X connection to :0.0 host broken (explicit kill or server shutdown)
I have tried switching the renderer to ZBUFFER, but that does not help either.

Best Answer

This seems to be an issue with using OPENGL or ZBUFFER with the X server. By default, the MESH command uses the OPENGL renderer which causes crashes in this situation.
A workaround is to set the renderer to PAINTERS immediately before calling the MESH command by using the following command:
set(gcf,'renderer','painters')
Another workaround is to force MATLAB to use the software version of OpenGL. This can be done by executing the following command:
opengl software
Note that Macintosh systems do not support software OpenGL.