from OpenGL.platform import baseplatform, ctypesloader
assert hasattr( ctypes, 'RTLD_GLOBAL' ), """Old ctypes without ability to load .so for global resolution: Get ctypes CVS branch_1_0, not CVS HEAD or released versions!"""
class GLXPlatform( baseplatform.BasePlatform ):
"""Posix (Linux, FreeBSD, etceteras) implementation for PyOpenGL"""
# On Linux (and, I assume, most GLX platforms, we have to load
# GL and GLU with the "global" flag to allow GLUT to resolve its
# references to GL/GLU functions).
GL = OpenGL = ctypesloader.loadLibrary(
ctypes.cdll,
'GL',
mode=ctypes.RTLD_GLOBAL
)
GLU = ctypesloader.loadLibrary(
ctypes.cdll,
'GLU',
mode=ctypes.RTLD_GLOBAL
)
# glut shouldn't need to be global, but just in case a dependent library makes
# the same assumption GLUT does...
try:
GLUT = ctypesloader.loadLibrary(
ctypes.cdll,
'glut',
mode=ctypes.RTLD_GLOBAL
)
except OSError, err:
GLUT = None
# GLX doesn't seem to have its own loadable module?