1"""Version 1.2 Image-handling functions
2
3Almost all of the 1.2 enhancements are image-handling-related,
4so this is, most of the 1.2 wrapper code...
5
6Note that the functions that manually wrap certain operations are
7guarded by if simple.functionName checks, so that you can use
8if functionName to see if the function is available at run-time.
9"""
10from OpenGL import wrapper, constants, arrays
11from OpenGL.raw.GL.ARB import imaging
12from OpenGL.raw.GL.VERSION import GL_1_2 as _simple
13from OpenGL.GL.ARB.imaging import *
14
15from OpenGL.GL import images
16import ctypes
17
18for suffix,arrayConstant in [
19    ('b', constants.GL_BYTE),
20    ('f', constants.GL_FLOAT),
21    ('i', constants.GL_INT),
22    ('s', constants.GL_SHORT),
23    ('ub', constants.GL_UNSIGNED_BYTE),
24    ('ui', constants.GL_UNSIGNED_INT),
25    ('us', constants.GL_UNSIGNED_SHORT),
26]:
27    for functionName in (
28        'glTexImage3D',
29        'glTexSubImage3D', # extension/1.2 standard
30    ):
31        functionName, function = images.typedImageFunction(
32            suffix, arrayConstant, getattr(_simple, functionName),
33        )
34        globals()[functionName] = function
35        try:
36            del function, functionName
37        except NameError as err:
38            pass
39    try:
40        del suffix,arrayConstant
41    except NameError as err:
42        pass
43
44glTexImage3D = images.setDimensionsAsInts(
45    images.setImageInput(
46        _simple.glTexImage3D,
47        typeName = 'type',
48    )
49)
50glTexSubImage3D = images.setDimensionsAsInts(
51    images.setImageInput(
52        _simple.glTexSubImage3D,
53        typeName = 'type',
54    )
55)
56