Setting up X11 and OpenGL on your laptop/desktop
X11
X11
is the GUI-display protocol used by UNIX systems. If you're logging into one of the Nevis systems with your own computer (laptop or desktop) using a plain-text Terminal program, you will almost certainly need X11 to run applications such as
ROOT
.
If you try to run a program and you get messages of the form
Can't open display
, then it probably means that you did not forward your X11 connection as described in the following steps. To check this, on the remote system examine the value of the variable
$DISPLAY
:
echo $DISPLAY
If
$DISPLAY
has a value (typically of the form
localhost:NN:N
) then the X11 connection has been forwarded correctly. If
$DISPLAY
is blank, then something has gone wrong with one of the steps (did you remember to capitalize
-XY
?).
Note that X11 spews forth error messages constantly. If the program is working and you see the graphics you expect, ignore these messages. In particular, this message is common and does not indicate that anything is wrong:
libGL error: failed to load driver: swrast
Setting up X11 on Linux
It's there. Note that you can set up X11 forwarding the same way as described for Mac OS.
Note: X11 might not be there if you set up your laptop with a minimal text-only Linux installation without graphics. If you have that level of expertise, I'll assume you know how to install X11 if you need it.
Setting up X11 on Mac OS
For Mac OS 10.7 and later, you're going to need to install
XQuartz
.
Note: You rarely have to deliberately start up XQuartz. If an application uses X11, XQuartz will detect it and automatically start itself.
You'll want to enable
X11 forwarding
. There are two ways to do this:
- When you use ssh
to connect to a Nevis system, use the -X -Y
options (or just -XY
). For example:
ssh -XY jsmith@olga.nevis.columbia.edu
- If you don't want to type
-XY
every single time you login to a Nevis system, you can change your ssh
options so that -XY
are automatically activated. To do this, in Mac OS edit the file ~/.ssh/config
and add the following lines (strictly speaking, only the first line is necessary):
ForwardX11 yes
ForwardX11Trusted yes
ForwardAgent yes
Setting up X11 on Microsoft Windows
You will need both an
ssh
emulator and an X11 emulator. I suggest
mobaXterm
, which provides both and is free. Be sure to check out the
documentation
; I don't know anything about the program except what I read on that page.
After you've downloaded and installed mobaXterm, you will want to turn on X11 forwarding. This
post
has details about how to do this. Note that "host" refers to the name of a server at Nevis and "username" is your Nevis account name; e.g., a command like
ssh -XY jsmith@olga.nevis.columbia.edu
implies that in mobaXterm you'd put
olga.nevis.columbia.edu
for the hostname and
jsmith
for the username.
OpenGL
You probably don't need to enable OpenGL at all. In case you do (your collaboration will let you know), there's how.
Some X11 applications use
OpenGL
; in physics, a notable example is
Geant4
. The idea behind OpenGL is that it can use the graphics hardware on your computer to render graphics; sometimes this works. If you run an X11 program and you get a lot of error messages about graphics and/or blank regions in your windows, you can see if the program requires OpenGL.
OpenGL on Linux
It's probably sufficient to install the glx-utils package on Linux if it's not already installed. You can test if that package is already installed using the
glxinfo
command. If you get any output other than "glxinfo not found" then you have the package.
If glx-utils is not installed, the commands to do this are:
- In Debian/Ubuntu flavors of Linux:
sudo apt-get install glx-utils
sudo yum install glx-utils
You may also need to install the drivers for your particular graphics card. Consult the web site of the manufacturer and look for instructions on how to install Linux drivers.
OpenGL on Mac OS
OpenGL is
not enabled in XQuartz by default. You'll have to do the following:
- Find out which version of XQuartz you're using. Within XQuartz, go to the XQuartz menu and select
About X11
.
- If you are running XQuartz 2.8 or later, open the Terminal app (in Applications->Utilities) and copy-and-paste the following command:
defaults write org.xquartz.X11 enable_iglx -bool true
- If you are running XQuartz 2.7.x or earlier (which might be the case if you installed it some time ago), open the Terminal app (in Applications->Utilities) and copy-and-paste the following command:
defaults write org.macosforge.xquartz.X11 enable_iglx -bool true
OpenGL on Microsoft Windows
mobaXterm
contains an OpenGL renderer; there should be no additional steps needed.
In the Settings->X11 tab, you'll see a setting that allows you to choose between OpenGL rendering: hardware, software, or none. "Hardware" will only work if you have the appropriate OpenGL drivers installed for your graphics card. Probably "software" or "none" should work as-is.