The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/texture_compression.txt
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions, wrapper
from OpenGL.GL import glget
import ctypes
from OpenGL.raw.GL.ARB.texture_compression import *
### END AUTOGENERATED SECTION
from OpenGL.GL import images

for dimensions in (1,2,3):
    for function in ('glCompressedTexImage%sDARB','glCompressedTexSubImage%sDARB'):
        name = function%(dimensions,)
        globals()[ name ] = images.compressedImageFunction(
            globals()[ name ]
        )
        try:
            del name, function
        except NameError as err:
            pass
    try:
        del dimensions
    except NameError as err:
        pass

if glGetCompressedTexImageARB:
    def glGetCompressedTexImageARB( target, level, img=None ):
        """Retrieve a compressed texture image"""
        if img is None:
            length = glget.glGetTexLevelParameteriv(
Ejemplo n.º 2
0
### END AUTOGENERATED SECTION
GL_SRC0_ALPHA = GL_SOURCE0_ALPHA  # alias
GL_SRC0_RGB = GL_SOURCE0_RGB  # alias
GL_SRC1_ALPHA = GL_SOURCE1_ALPHA  # alias
GL_SRC1_RGB = GL_SOURCE1_RGB  # alias
GL_SRC2_ALPHA = GL_SOURCE2_ALPHA  # alias
GL_SRC2_RGB = GL_SOURCE2_RGB  # alias

from OpenGL import wrapper
from OpenGL.raw.GL.VERSION import GL_1_3 as _simple
from OpenGL.GL import images, glget

for dimensions in (1, 2, 3):
    for function in ('glCompressedTexImage%sD', 'glCompressedTexSubImage%sD'):
        name = function % (dimensions, )
        globals()[name] = images.compressedImageFunction(getattr(
            _simple, name))
        try:
            del name, function
        except NameError as err:
            pass
    try:
        del dimensions
    except NameError as err:
        pass

if _simple.glGetCompressedTexImage:

    def glGetCompressedTexImage(target, level, img=None):
        """Retrieve a compressed texture image"""
        if img is None:
            length = glget.glGetTexLevelParameteriv(
Ejemplo n.º 3
0
"""OpenGL version 1.3 imaging-handling routines"""
from OpenGL import wrapper, constants, arrays
from OpenGL.raw.GL.VERSION import GL_1_3 as simple
from OpenGL.GL import images, glget

for dimensions in (1,2,3):
    for function in ('glCompressedTexImage%sD','glCompressedTexSubImage%sD'):
        name = function%(dimensions,)
        globals()[ name ] = images.compressedImageFunction(
            getattr( simple, name )
        )
        del name, function
    del dimensions

if simple.glGetCompressedTexImage:
    def glGetCompressedTexImage( target, level, img=None ):
        """Retrieve a compressed texture image"""
        if img is None:
            length = glget.glGetTexLevelParameteriv(
                target, 0, 
                simple.GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, 
            )
            img = arrays.ArrayDataType.zeros( (length,), constants.GL_UNSIGNED_BYTE )
        return simple.glGetCompressedTexImage(target, 0, img);