Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run GLU (OpenGL) on a headless server?

we're trying to use GLU's tesselation functions on a headless, GNU/linux server. We'd like to use PyOpenGL for that, but the problem is that it crashes on a call to gluNewTess (Segmentation fault)

gdb backtrace says it's in glGetError, that makes me think that GLU tesselation needs a GL context? Or is it just some intricacy in PyOpenGL?

I tried to find some information on how to initialize GL context on a headless (and virtualized) machine, no luck. Any information on these topics is appreciated.

like image 954
skrat Avatar asked Jun 08 '11 16:06

skrat


People also ask

What is headless mode server?

A headless server is a computing device without a local interface that is dedicated to providing services to other computers and their users. Headless, in this context, basically means that the computing device has no monitor or peripherals, such as a keyboard and mouse.

How do I run a headless server?

One can make a server a headless server by connecting it to a network and removing the monitor, mouse, keyboard, and peripherals. The only way to access a headless server is to use networking tools such as ssh and vnc server. You may ask why somebody needs to create a headless server.

How do I connect to a headless Linux server?

Going Headless Almost any Linux server can be configured to go headless by enabling ssh or telnet, then disconnecting the monitor, keyboard and mouse. Reset all default passwords with secure passwords. Fire up a second computer on the same network, start the ssh or telnet client and log on to the headless server.

What is headless terminal?

A headless terminal is a terminal with an internal screen buffer. When the display is changed, the change event is emitted with the display buffer as an argument.


2 Answers

easiest:

Xvfb :5 -screen 0 800x600x24 &
export DISPLAY=:5
glxgears 

instead of glxgears, replace with your program, and stick a 'glutInit()' into your python code to get a basic GL window.

harder:

rewrite your program to create an GL context using the OSMesa library

hardest:

rip the guts out of the GLU tesselator and stick it in your project (download the MesaLib source code)

like image 133
don bright Avatar answered Oct 05 '22 06:10

don bright


Most of the options at VJovic's link aren't hardware accelerated and all of them are deprecated in favor of the OpenGL Framebuffer Object extension (Notice the date: 1997!). Also, offscreen rendering isn't the whole solution, as Calvin1602 noted, you need an openGL context (except for OSMesa, which uses software rendering).

Our research lab has been doing headless opengl rendering for about a year (you can see my related serverfault question here), and we found that the easiest thing was to just give users remote access to the server's local X-screen. The downsides: (a) giving remote access to the x-server is regarded by some as a bad security practice if done wrong, and (b) it opens a dummy window will pop up on the server's display, but if it's headless, this shouldn't matter. A few other options are described in the ServerFault link too, if you're interested.

You need an x-screen running on the server, and it should be noted that some video cards require a physical monitor to be attached if you want to start an x-screen. The NVidia driver lets you get around this using the ConnectedMonitor option in xorg.conf.. Another option I've used in the past is to the build a dummy monitor plug. that makes the system think there's a CRT monitor attached. There are probably other solutions.

Good Luck!

https://serverfault.com/questions/186805/remote-offscreen-rendering

like image 34
Kyle Simek Avatar answered Oct 05 '22 07:10

Kyle Simek