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 / GL / ARB / texture_compression.py < prev    next >
Encoding:
Python Source  |  2008-12-07  |  1.0 KB  |  34 lines

  1. '''OpenGL extension ARB.texture_compression
  2.  
  3. This module customises the behaviour of the 
  4. OpenGL.raw.GL.ARB.texture_compression to provide a more 
  5. Python-friendly API
  6. '''
  7. from OpenGL import platform, constants, constant, arrays
  8. from OpenGL import extensions, wrapper
  9. from OpenGL.GL import glget
  10. import ctypes
  11. from OpenGL.raw.GL.ARB.texture_compression import *
  12. ### END AUTOGENERATED SECTION
  13. from OpenGL.GL import images
  14.  
  15. for dimensions in (1,2,3):
  16.     for function in ('glCompressedTexImage%sDARB','glCompressedTexSubImage%sDARB'):
  17.         name = function%(dimensions,)
  18.         globals()[ name ] = images.compressedImageFunction(
  19.             globals()[ name ]
  20.         )
  21.         del name, function
  22.     del dimensions
  23.  
  24. if glGetCompressedTexImageARB:
  25.     def glGetCompressedTexImageARB( target, level, img=None ):
  26.         """Retrieve a compressed texture image"""
  27.         if img is None:
  28.             length = glget.glGetTexLevelParameteriv(
  29.                 target, 0, 
  30.                 GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, 
  31.             )
  32.             img = arrays.ArrayDataType.zeros( (length,), constants.GL_UNSIGNED_BYTE )
  33.         return glGetCompressedTexImageARB(target, 0, img);
  34.