home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / lib / site-packages / OpenGL / platform / __init__.py next >
Encoding:
Python Source  |  2008-12-07  |  1.1 KB  |  37 lines

  1. """Abstraction for the platform-specific code in PyOpenGL
  2.  
  3. Each supported platform has a module which provides the
  4. specific functionality required to support the base OpenGL 
  5. functionality on that platform.  These modules are 
  6. registered using plugins in the:
  7.  
  8.     OpenGL.plugin.PlatformPlugin
  9.  
  10. objects.  To support a new platform you'll need to create
  11. a new PlatformPlugin instance *before* you import 
  12. OpenGL.platform .  Once you have a working platform 
  13. module, please consider contributing it back to the project.
  14.  
  15. See baseplatform.BasePlatform for the core functionality 
  16. of a platform implementation.  See the various platform 
  17. specific modules for examples to use when porting.
  18. """
  19. import os, sys
  20. from OpenGL.plugins import PlatformPlugin
  21.  
  22. def _load( ):
  23.     """Load the os.name plugin for the platform functionality"""
  24.     
  25.     key = (sys.platform,os.name)
  26.     plugin  = PlatformPlugin.match( key )
  27.     plugin_class = plugin.load()
  28.     plugin.loaded = True
  29.     # create instance of this platform implementation
  30.     plugin = plugin_class()
  31.  
  32.     # install into the platform module's namespace now
  33.     plugin.install(globals())
  34.     return plugin
  35.  
  36. _load()
  37.