1import ctypes 2from OpenGL.constant import Constant 3from OpenGL._bytes import bytes,unicode,as_8_bit, long 4from OpenGL._opaque import opaque_pointer_cls as _opaque_pointer_cls 5sizeof = ctypes.sizeof 6 7GL_FALSE = Constant( 'GL_FALSE', 0x0 ) 8GL_TRUE = Constant( 'GL_TRUE', 0x1 ) 9GL_BYTE = Constant( 'GL_BYTE', 0x1400 ) 10GL_UNSIGNED_BYTE = Constant( 'GL_UNSIGNED_BYTE', 0x1401 ) 11GL_SHORT = Constant( 'GL_SHORT', 0x1402 ) 12GL_UNSIGNED_SHORT = Constant( 'GL_UNSIGNED_SHORT', 0x1403 ) 13GL_INT = Constant( 'GL_INT', 0x1404 ) 14GL_UNSIGNED_INT = Constant( 'GL_UNSIGNED_INT', 0x1405 ) 15GL_UNSIGNED_INT64 = Constant( 'GL_UNSIGNED_INT64_AMD', 0x8BC2 ) 16GL_FLOAT = Constant( 'GL_FLOAT', 0x1406 ) 17GL_DOUBLE = Constant( 'GL_DOUBLE', 0x140a ) 18GL_CHAR = bytes 19GL_HALF_FLOAT = Constant( 'GL_HALF_FLOAT_ARB',0x140B) 20GL_HALF_NV = Constant( 'GL_HALF_NV', 0x1401 ) 21GL_VOID_P = object() 22 23BYTE_SIZES = { 24 GL_BYTE: 1, 25 GL_CHAR: 1, 26 GL_UNSIGNED_BYTE: 1, 27 GL_SHORT: 2, 28 GL_UNSIGNED_SHORT: 2, 29 GL_INT: 4, 30 GL_UNSIGNED_INT: 4, 31 GL_UNSIGNED_INT64: 8, 32 GL_FLOAT: 4, 33 GL_DOUBLE: 8, 34} 35 36ARRAY_TO_GL_TYPE_MAPPING = { 37 'c': GL_UNSIGNED_BYTE, 38 'f': GL_FLOAT, 39 'b': GL_BYTE, 40 'i': GL_INT, 41 'l': GL_INT, 42 '?': GL_INT,# Boolean 43 'd': GL_DOUBLE, 44 'L': GL_UNSIGNED_INT, 45 'h': GL_SHORT, 46 'H': GL_UNSIGNED_SHORT, 47 'B': GL_UNSIGNED_BYTE, 48 'I': GL_UNSIGNED_INT, 49 None: None, 50} 51