I am working through the Opengl Bible 5th edition. Due to a recent hardware failure my primary machine is now an old laptop that does not support the opengl standard for my tutorial book. I have a headless server running Ubuntu 11.10 which has a capable graphics card. I would like to code though SSH and have my compiled program display on a monitor attached to the server. How would I go about doing this?
You did not specify too much about your environment, so let's go one by one. First, if you were running Ubuntu (or any GNU/Linux for that matter) on your previous machine, you are most likely using X Windows for display in your OpenGL applications. Given that assumption, all you need is a working X Windows server on your "headless" server (note that when you attach a monitor, it's not headless anymore). If you don't have it installed (which would be the case if you installed Ubuntu Server edition, for example), you need to install it first, check this:
Note that it's not advisable to install X (or anything not necessary) on pure-servers for various reasons, see Arguments Against a GUI section in the above link to see some of them and decide whether it's something you want to do or not.
When you have that installed (which you can check e.g. by running
dpkg -s xserver-xorg-code
in terminal and checkingStatus
line) and fired it up, you can test it by launching e.g.xeyes
or other sample X applications. First, make sure you haveDISPLAY
environment variable set:From this:
you can see that this variable has the following format:
with
hostname
omitted above meaninglocalhost
. If this works (e.g. runningxeyes
actually displays those funny eyes that track your mouse), you are all set X-wise.If you don't have a SSH server installed, you need to install it - it's fairly simple, here's one of many tutorials:
Check that your ssh is working by running
ssh <target IP>
from your laptop, e.g.:if your server's IP is 10.0.0.5. If that succeeds, you are all set.
Now that you can SSH to the server, all you need to do is just run
xeyes
from within SSH connection. It might be that yourDISPLAY
variable is not set when you ssh, so ifecho $DISPLAY
returns nothing, you can run this:provided you use
bash
, which is probably the case.If, on the other hand, you want to run the app itself on the laptop and just display on the server, all you have to do is change the
DISPLAY
variable and it would work, e.g.:providing that IP of your server is 10.0.0.5. You can try the above in terminal following by
xeyes
and you should again see those funny eyes displaying on your server's monitor.Hope this helps.
I had similar problem. Good solution for that is VirtualGL http://www.virtualgl.org/
It's pretty easy to set up. Here's the manual.
It runs the application on the server and redirects OpenGL output to the client as raw frames (afair compressed for better performance).