OSMesa

Revision as of 08:55, 18 November 2017 by Andy1978 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

OSMesa is used since Octave 4.0 for offscreen rendering from OpenGL toolkits FLTK and Qt.

This enables printing without a X display, for example when ssh'ing to a remote machine, or if the figure is invisible (#33180).


libOSMesaEdit

The minimum required version of OSMesa for Octave is 9.0.0. Versions < 9.0 show a strange bug where the return values of

 glGetIntegerv (GL_DEPTH_BITS, &z);
 glGetIntegerv (GL_STENCIL_BITS, &s);
 glGetIntegerv (GL_ACCUM_RED_BITS, &a);

contain arbitrary values and the rendered buffer is garbage. This only happens if OSMesa is linked together with Octave, standalone OSMesa examples works fine.

On Debian GNU/Linux 8.0 (jessie), Ubuntu 14.04 (trusty) and Fedora 21 there is no need to build OSMesa from source, just use your package manager which installs libosmesa > 10.0.

Build libOSMesa from sourceEdit

Needed for example for Debian wheezy or Ubuntu 12.04.5 which ships OSMesa 8.0.5.

 wget -nc ftp://ftp.freedesktop.org/pub/mesa/current/mesa-10.5.4.tar.xz
 tar Jxf mesa-10.5.4.tar.xz
 cd mesa-10.5.4/
 
 autoreconf -fi
 
 ./configure \
   CXXFLAGS="-O2 -g -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
   CFLAGS="-O2 -g -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
   --disable-xvmc \
   --disable-glx \
   --disable-dri \
   --with-dri-drivers="" \
   --with-gallium-drivers="" \
   --disable-shared-glapi \
   --disable-egl \
   --with-egl-platforms="" \
   --enable-osmesa \
   --enable-gallium-llvm=no \
   --prefix=/usr/local/mesa/10.2.2/classic
 make -j4
 # optional
 make check
 sudo make install

Floating point texturesEdit

Floating point textures are disabled by default due to patent restrictions. We should check if we can enable it with "--enable-texture-float"

known problemsEdit

Unfortunately, there are several known problems with using on-screen Mesa and OSMesa at the same time. The --without-OSMesa configure can be used to disable OSMesa if a problem is encountered.

  • #44478 segmentation fault when using proprietary Nvidia drivers
  • #44979 clumsy/missing configure check, relies on runtime failure
  • #44338 doesn't work at all on Windows
  • LP #1424059 libosmesa6 is not installable on Ubuntu 14.04 with HWE updates
  • #50479 doesn't work at all with libglvnd, now standard in most distributions

workaroundsEdit

  • Preload the Mesa libGL.so, for example
 export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGL.so

Reporting BugsEdit

  • Please include the output of
 glxinfo | grep "^OpenGL \(renderer\|core profile version\|vendor\)"