File: osmesa_gl.py

package info (click to toggle)
python-vispy 0.15.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,868 kB
  • sloc: python: 59,799; javascript: 6,800; makefile: 69; sh: 6
file content (17 lines) | stat: -rw-r--r-- 597 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
from . import logger


def fix_osmesa_gl_lib():
    """
    When using OSMesa, the gl functions (from libGL) are included
    in libOSMesa.so. This function modifies the VISPY_GL_LIB env variable
    so gl2 picks up libOSMesa.so as the OpenGL library.

    This modification must be done before vispy.gloo is imported for the
    first time.
    """
    if 'VISPY_GL_LIB' in os.environ:
        logger.warning('VISPY_GL_LIB is ignored when using OSMesa. Use '
                       'OSMESA_LIBRARY instead.')
    os.environ['VISPY_GL_LIB'] = os.getenv('OSMESA_LIBRARY', 'libOSMesa.so')