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

skrat picture skrat · Jun 8, 2011 · Viewed 11.7k times · Source

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.

Answer

don bright picture don bright · Jan 22, 2012

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)