3

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?

3
  • 2
    Please clarify - you have a headless server with a monitor attached?
    – ziesemer
    Dec 27, 2011 at 23:08
  • stackoverflow.com might be a better spot for this question. (Likely a lot of users there that are doing something very similar.)
    – ziesemer
    Dec 27, 2011 at 23:26
  • @ziesemer - My box is normally headless. I attached a monitor for my coding purposes. What I really mean to say is I am doing all my input remotely and want to make use of the server's graphics card and monitor.
    – Paul
    Dec 27, 2011 at 23:31

2 Answers 2

2

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 checking Status line) and fired it up, you can test it by launching e.g. xeyes or other sample X applications. First, make sure you have DISPLAY environment variable set:

$ echo $DISPLAY
:0.0

From this:

you can see that this variable has the following format:

hostname:displaynumber.screennumber

with hostname omitted above meaning localhost. If this works (e.g. running xeyes 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.:

$ ssh 10.0.0.5

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 your DISPLAY variable is not set when you ssh, so if echo $DISPLAY returns nothing, you can run this:

$ export DISPLAY=:0.0

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.:

$ export DISPLAY=10.0.0.5:0.0

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.

2

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .