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 / __init__.py next >
Encoding:
Python Source  |  2008-12-07  |  4.5 KB  |  124 lines

  1. """ctypes-based OpenGL wrapper for Python
  2.  
  3. This is the PyOpenGL 3.x tree, it attempts to provide
  4. a largely compatible API for code written with the 
  5. PyOpenGL 2.x series using the ctypes foreign function 
  6. interface system.
  7.  
  8. Configuration Variables:
  9.  
  10. There are a few configuration variables in this top-level
  11. module.  Applications should be the only code that tweaks 
  12. these variables, mid-level libraries should not take it 
  13. upon themselves to disable/enable features at this level.
  14. The implication there is that your library code should be 
  15. able to work with any of the valid configurations available
  16. with these sets of flags.
  17.  
  18.     ERROR_CHECKING -- if set to a False value before
  19.         importing any OpenGL.* libraries will completely 
  20.         disable error-checking.  This can dramatically
  21.         improve performance, but makes debugging far 
  22.         harder.
  23.         
  24.         This is intended to be turned off *only* in a 
  25.         production environment where you *know* that 
  26.         your code is entirely free of situations where you 
  27.         use exception-handling to handle error conditions,
  28.         i.e. where you are explicitly checking for errors 
  29.         everywhere they can occur in your code.
  30.         
  31.         Default: True 
  32.  
  33.     ERROR_LOGGING -- If True, then wrap array-handler 
  34.         functions with  error-logging operations so that all exceptions 
  35.         will be reported to log objects in OpenGL.logs, note that 
  36.         this means you will get lots of error logging whenever you 
  37.         have code that tests by trying something and catching an 
  38.         error, this is intended to be turned on only during 
  39.         development so that you can see why something is failing.
  40.         
  41.         Errors are normally logged to the OpenGL.errors logger.
  42.         
  43.         Only triggers if ERROR_CHECKING is True
  44.         
  45.         Default: False
  46.         
  47.     ERROR_ON_COPY -- if set to a True value before 
  48.         importing the numpy array-support module, will 
  49.         cause array operations to raise 
  50.         OpenGL.error.CopyError if an array operation 
  51.         would cause a data-copy in order to match
  52.         data-types.
  53.         
  54.         This feature allows for optimisation of your 
  55.         application.  It should only be enabled during 
  56.         testing stages to prevent raising errors on 
  57.         recoverable conditions at run-time.  
  58.         
  59.         Note that this feature only works with Numpy 
  60.         arrays at the moment.
  61.         
  62.         Default: False
  63.     
  64.     WARN_ON_FORMAT_UNAVAILABLE -- If True, generates
  65.         logging-module warn-level events when a FormatHandler
  66.         plugin is not loadable (with traceback).
  67.     
  68.     FULL_LOGGING -- If True, then wrap functions with 
  69.         logging operations which reports each call along with its 
  70.         arguments to  the OpenGL.calltrace logger at the INFO 
  71.         level.  This is *extremely* slow.  You should *not* enable 
  72.         this in production code! 
  73.         
  74.         You will need to have a  logging configuration (e.g. 
  75.             logging.basicConfig() 
  76.         ) call  in your top-level script to see the results of the 
  77.         logging.
  78.         
  79.         Default: False
  80.     
  81.     ALLOW_NUMPY_SCALARS -- if True, we will wrap 
  82.         all GLint/GLfloat calls conversions with wrappers 
  83.         that allow for passing numpy scalar values.
  84.         
  85.         Note that this is experimental, *not* reliable,
  86.         and very slow!
  87.         
  88.         Note that byte/char types are not wrapped.
  89.         
  90.         Default: False
  91.     
  92.     UNSIGNED_BYTE_IMAGES_AS_STRING -- if True, we will return
  93.         GL_UNSIGNED_BYTE image-data as strings, istead of arrays
  94.         for glReadPixels and glGetTexImage
  95. """
  96. from OpenGL.version import __version__
  97.  
  98. ERROR_CHECKING = True
  99. ERROR_LOGGING = False
  100. ERROR_ON_COPY = False
  101. WARN_ON_FORMAT_UNAVAILABLE = False
  102.  
  103. FULL_LOGGING = False 
  104. ALLOW_NUMPY_SCALARS = False
  105. UNSIGNED_BYTE_IMAGES_AS_STRING = True
  106.  
  107. # Declarations of plugins provided by PyOpenGL itself
  108. from OpenGL.plugins import PlatformPlugin, FormatHandler
  109. PlatformPlugin( 'nt', 'OpenGL.platform.win32.Win32Platform' )
  110. PlatformPlugin( 'posix ', 'OpenGL.platform.glx.GLXPlatform' )
  111. PlatformPlugin( 'linux2', 'OpenGL.platform.glx.GLXPlatform' )
  112. PlatformPlugin( 'darwin', 'OpenGL.platform.darwin.DarwinPlatform' )
  113.  
  114. FormatHandler( 'none', 'OpenGL.arrays.nones.NoneHandler' )
  115. FormatHandler( 'str', 'OpenGL.arrays.strings.StringHandler' )
  116. FormatHandler( 'list', 'OpenGL.arrays.lists.ListHandler', ['__builtin__.list','__builtin__.tuple'] )
  117. FormatHandler( 'numbers', 'OpenGL.arrays.numbers.NumberHandler' )
  118. FormatHandler( 'ctypesarray', 'OpenGL.arrays.ctypesarrays.CtypesArrayHandler' )
  119. FormatHandler( 'ctypesparameter', 'OpenGL.arrays.ctypesparameters.CtypesParameterHandler' )
  120. FormatHandler( 'ctypespointer', 'OpenGL.arrays.ctypespointers.CtypesPointerHandler' )
  121. FormatHandler( 'numpy', 'OpenGL.arrays.numpymodule.NumpyHandler', ['numpy.ndarray'] )
  122. #FormatHandler( 'numarray', 'OpenGL.arrays.numarrays.NumarrayHandler' )
  123. FormatHandler( 'numeric', 'OpenGL.arrays.numeric.NumericHandler', )
  124.