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

  1. '''OpenGL extension ARB.texture_compression
  2.  
  3. Overview (from the spec)
  4.     
  5.         Compressing texture images can reduce texture memory utilization and
  6.         improve performance when rendering textured primitives.  This extension
  7.         allows OpenGL applications to use compressed texture images by providing:
  8.     
  9.         (1) A framework upon which extensions providing specific compressed
  10.             image formats can be built.
  11.     
  12.         (2) A set of generic compressed internal formats that allow
  13.             applications to specify that texture images should be stored in
  14.             compressed form without needing to code for specific compression
  15.             formats.
  16.     
  17.         An application can define compressed texture images by providing a texture
  18.         image stored in a specific compressed image format.  This extension does
  19.         not define any specific compressed image formats, but it does provide the
  20.         mechanisms necessary to enable other extensions that do.
  21.     
  22.         An application can also define compressed texture images by providing an
  23.         uncompressed texture image but specifying a compressed internal format.
  24.         In this case, the GL will automatically compress the texture image using
  25.         the appropriate image format.  Compressed internal formats can either be
  26.         specific (as above) or generic.  Generic compressed internal formats are
  27.         not actual image formats, but are instead mapped into one of the specific
  28.         compressed formats provided by the GL (or to an uncompressed base internal
  29.         format if no appropriate compressed format is available).  Generic
  30.         compressed internal formats allow applications to use texture compression
  31.         without needing to code to any particular compression algorithm.  Generic
  32.         compressed formats allow the use of texture compression across a wide
  33.         range of platforms with differing compression algorithms and also allow
  34.         future GL implementations to substitute improved compression methods
  35.         transparently.
  36.     
  37.         Compressed texture images can be obtained from the GL in uncompressed form
  38.         by calling GetTexImage and in compressed form by calling
  39.         GetCompressedTexImageARB.  Queried compressed images can be saved and
  40.         later reused by calling CompressedTexImage[123]DARB.  Pre-compressed
  41.         texture images do not need to be processed by the GL and should
  42.         significantly improve texture loading performance relative to uncompressed
  43.         images.
  44.     
  45.         This extension does not define specific compressed image formats (e.g.,
  46.         S3TC, FXT1), nor does it provide means to encode or decode such images.
  47.         To support images in a specific compressed format, a hardware vendor
  48.         would:
  49.     
  50.           (1) Provide a new extension defininig specific compressed
  51.           <internalformat> and <format> tokens for TexImage[123]D,
  52.           TexSubImage[123]D, CopyTexImage[12]D, CompressedTexImage[123]DARB,
  53.               CompressedTexSubImage[123]DARB, and GetCompressedTexImageARB calls.
  54.     
  55.           (2) Specify the encoding of compressed images of that specific format.
  56.     
  57.           (3) Specify a method for deriving the size of compressed images of that
  58.           specific format, using the <internalformat>, <width>, <height>,
  59.           <depth> parameters, and (if necessary) the compressed image itself.
  60.  
  61. The official definition of this extension is available here:
  62.     http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_compression.txt
  63.  
  64. Automatically generated by the get_gl_extensions script, do not edit!
  65. '''
  66. from OpenGL import platform, constants, constant, arrays
  67. from OpenGL import extensions
  68. from OpenGL.GL import glget
  69. import ctypes
  70. EXTENSION_NAME = 'GL_ARB_texture_compression'
  71. GL_COMPRESSED_ALPHA_ARB = constant.Constant( 'GL_COMPRESSED_ALPHA_ARB', 0x84E9 )
  72. GL_COMPRESSED_LUMINANCE_ARB = constant.Constant( 'GL_COMPRESSED_LUMINANCE_ARB', 0x84EA )
  73. GL_COMPRESSED_LUMINANCE_ALPHA_ARB = constant.Constant( 'GL_COMPRESSED_LUMINANCE_ALPHA_ARB', 0x84EB )
  74. GL_COMPRESSED_INTENSITY_ARB = constant.Constant( 'GL_COMPRESSED_INTENSITY_ARB', 0x84EC )
  75. GL_COMPRESSED_RGB_ARB = constant.Constant( 'GL_COMPRESSED_RGB_ARB', 0x84ED )
  76. GL_COMPRESSED_RGBA_ARB = constant.Constant( 'GL_COMPRESSED_RGBA_ARB', 0x84EE )
  77. GL_TEXTURE_COMPRESSION_HINT_ARB = constant.Constant( 'GL_TEXTURE_COMPRESSION_HINT_ARB', 0x84EF )
  78. glget.addGLGetConstant( GL_TEXTURE_COMPRESSION_HINT_ARB, (1,) )
  79. GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB = constant.Constant( 'GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB', 0x86A0 )
  80. GL_TEXTURE_COMPRESSED_ARB = constant.Constant( 'GL_TEXTURE_COMPRESSED_ARB', 0x86A1 )
  81. GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB = constant.Constant( 'GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB', 0x86A2 )
  82. glget.addGLGetConstant( GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, (1,) )
  83. GL_COMPRESSED_TEXTURE_FORMATS_ARB = constant.Constant( 'GL_COMPRESSED_TEXTURE_FORMATS_ARB', 0x86A3 )
  84. glget.addGLGetConstant( GL_COMPRESSED_TEXTURE_FORMATS_ARB, (1,) )
  85. glCompressedTexImage3DARB = platform.createExtensionFunction( 
  86.     'glCompressedTexImage3DARB', dll=platform.GL,
  87.     extension=EXTENSION_NAME,
  88.     resultType=None, 
  89.     argTypes=(constants.GLenum, constants.GLint, constants.GLenum, constants.GLsizei, constants.GLsizei, constants.GLsizei, constants.GLint, constants.GLsizei, ctypes.c_void_p,),
  90.     doc = 'glCompressedTexImage3DARB( GLenum(target), GLint(level), GLenum(internalformat), GLsizei(width), GLsizei(height), GLsizei(depth), GLint(border), GLsizei(imageSize), c_void_p(data) ) -> None',
  91.     argNames = ('target', 'level', 'internalformat', 'width', 'height', 'depth', 'border', 'imageSize', 'data',),
  92. )
  93.  
  94. glCompressedTexImage2DARB = platform.createExtensionFunction( 
  95.     'glCompressedTexImage2DARB', dll=platform.GL,
  96.     extension=EXTENSION_NAME,
  97.     resultType=None, 
  98.     argTypes=(constants.GLenum, constants.GLint, constants.GLenum, constants.GLsizei, constants.GLsizei, constants.GLint, constants.GLsizei, ctypes.c_void_p,),
  99.     doc = 'glCompressedTexImage2DARB( GLenum(target), GLint(level), GLenum(internalformat), GLsizei(width), GLsizei(height), GLint(border), GLsizei(imageSize), c_void_p(data) ) -> None',
  100.     argNames = ('target', 'level', 'internalformat', 'width', 'height', 'border', 'imageSize', 'data',),
  101. )
  102.  
  103. glCompressedTexImage1DARB = platform.createExtensionFunction( 
  104.     'glCompressedTexImage1DARB', dll=platform.GL,
  105.     extension=EXTENSION_NAME,
  106.     resultType=None, 
  107.     argTypes=(constants.GLenum, constants.GLint, constants.GLenum, constants.GLsizei, constants.GLint, constants.GLsizei, ctypes.c_void_p,),
  108.     doc = 'glCompressedTexImage1DARB( GLenum(target), GLint(level), GLenum(internalformat), GLsizei(width), GLint(border), GLsizei(imageSize), c_void_p(data) ) -> None',
  109.     argNames = ('target', 'level', 'internalformat', 'width', 'border', 'imageSize', 'data',),
  110. )
  111.  
  112. glCompressedTexSubImage3DARB = platform.createExtensionFunction( 
  113.     'glCompressedTexSubImage3DARB', dll=platform.GL,
  114.     extension=EXTENSION_NAME,
  115.     resultType=None, 
  116.     argTypes=(constants.GLenum, constants.GLint, constants.GLint, constants.GLint, constants.GLint, constants.GLsizei, constants.GLsizei, constants.GLsizei, constants.GLenum, constants.GLsizei, ctypes.c_void_p,),
  117.     doc = 'glCompressedTexSubImage3DARB( GLenum(target), GLint(level), GLint(xoffset), GLint(yoffset), GLint(zoffset), GLsizei(width), GLsizei(height), GLsizei(depth), GLenum(format), GLsizei(imageSize), c_void_p(data) ) -> None',
  118.     argNames = ('target', 'level', 'xoffset', 'yoffset', 'zoffset', 'width', 'height', 'depth', 'format', 'imageSize', 'data',),
  119. )
  120.  
  121. glCompressedTexSubImage2DARB = platform.createExtensionFunction( 
  122.     'glCompressedTexSubImage2DARB', dll=platform.GL,
  123.     extension=EXTENSION_NAME,
  124.     resultType=None, 
  125.     argTypes=(constants.GLenum, constants.GLint, constants.GLint, constants.GLint, constants.GLsizei, constants.GLsizei, constants.GLenum, constants.GLsizei, ctypes.c_void_p,),
  126.     doc = 'glCompressedTexSubImage2DARB( GLenum(target), GLint(level), GLint(xoffset), GLint(yoffset), GLsizei(width), GLsizei(height), GLenum(format), GLsizei(imageSize), c_void_p(data) ) -> None',
  127.     argNames = ('target', 'level', 'xoffset', 'yoffset', 'width', 'height', 'format', 'imageSize', 'data',),
  128. )
  129.  
  130. glCompressedTexSubImage1DARB = platform.createExtensionFunction( 
  131.     'glCompressedTexSubImage1DARB', dll=platform.GL,
  132.     extension=EXTENSION_NAME,
  133.     resultType=None, 
  134.     argTypes=(constants.GLenum, constants.GLint, constants.GLint, constants.GLsizei, constants.GLenum, constants.GLsizei, ctypes.c_void_p,),
  135.     doc = 'glCompressedTexSubImage1DARB( GLenum(target), GLint(level), GLint(xoffset), GLsizei(width), GLenum(format), GLsizei(imageSize), c_void_p(data) ) -> None',
  136.     argNames = ('target', 'level', 'xoffset', 'width', 'format', 'imageSize', 'data',),
  137. )
  138.  
  139. glGetCompressedTexImageARB = platform.createExtensionFunction( 
  140.     'glGetCompressedTexImageARB', dll=platform.GL,
  141.     extension=EXTENSION_NAME,
  142.     resultType=None, 
  143.     argTypes=(constants.GLenum, constants.GLint, ctypes.c_void_p,),
  144.     doc = 'glGetCompressedTexImageARB( GLenum(target), GLint(level), c_void_p(img) ) -> None',
  145.     argNames = ('target', 'level', 'img',),
  146. )
  147.  
  148.  
  149. def glInitTextureCompressionARB():
  150.     '''Return boolean indicating whether this extension is available'''
  151.     return extensions.hasGLExtension( EXTENSION_NAME )
  152.