Types

arcade.gl.types.BufferProtocol

alias of ByteString | memoryview | array | Array

arcade.gl.types.BufferOrBufferProtocol

alias of ByteString | memoryview | array | Array | Buffer

arcade.gl.types.PyGLenum = <class 'int'>

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

arcade.gl.types.GLuintLike

alias of c_uint | int

arcade.gl.types.PyGLuint = <class 'int'>

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

arcade.gl.types.OpenGlFilter

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable’s items.

If the argument is a tuple, the return value is the same object.

alias of tuple[int, int]

arcade.gl.types.BlendFunction

alias of tuple[int, int] | tuple[int, int, int, int]

arcade.gl.types.compare_funcs: dict[str | None, int] = {'!=': 517, '0': 512, '1': 519, '<': 513, '<=': 515, '==': 514, '>': 516, '>=': 518, None: 0}

Depth compare functions

arcade.gl.types.swizzle_enum_to_str: dict[int, str] = {0: '0', 1: '1', 6403: 'R', 6404: 'G', 6405: 'B', 6406: 'A'}

Swizzle conversion lookup

arcade.gl.types.swizzle_str_to_enum: dict[str, int] = {'0': 0, '1': 1, 'A': 6406, 'B': 6405, 'G': 6404, 'R': 6403}

Swizzle conversion lookup

arcade.gl.types.pixel_formats = {'f1': ((0, 6403, 33319, 6407, 6408), (0, 33321, 33323, 32849, 32856), 5121, 1), 'f2': ((0, 6403, 33319, 6407, 6408), (0, 33325, 33327, 34843, 34842), 5131, 2), 'f4': ((0, 6403, 33319, 6407, 6408), (0, 33326, 33328, 34837, 34836), 5126, 4), 'i1': ((0, 36244, 33320, 36248, 36249), (0, 33329, 33335, 36239, 36238), 5120, 1), 'i2': ((0, 36244, 33320, 36248, 36249), (0, 33331, 33337, 36233, 36232), 5122, 2), 'i4': ((0, 36244, 33320, 36248, 36249), (0, 33333, 33339, 36227, 36226), 5124, 4), 'u1': ((0, 36244, 33320, 36248, 36249), (0, 33330, 33336, 36221, 36220), 5121, 1), 'u2': ((0, 36244, 33320, 36248, 36249), (0, 33332, 33338, 36215, 36214), 5123, 2), 'u4': ((0, 36244, 33320, 36248, 36249), (0, 33334, 33340, 36209, 36208), 5125, 4)}

Pixel format lookup (base_format, internal_format, type, size)

arcade.gl.types.SHADER_TYPE_NAMES = {35632: 'fragment shader', 35633: 'vertex shader', 36313: 'geometry shader', 36487: 'tessellation evaluation shader', 36488: 'tessellation control shader'}

String representation of a shader types

arcade.gl.types.GL_NAMES = {5120: 'GL_BYTE', 5121: 'GL_UNSIGNED_BYTE', 5122: 'GL_SHORT', 5123: 'GL_UNSIGNED_SHORT', 5124: 'GL_INT', 5125: 'GL_UNSIGNED_INT', 5126: 'GL_FLOAT', 5130: 'GL_DOUBLE', 5131: 'GL_HALF_FLOAT'}

Lookup table for OpenGL type names

arcade.gl.types.gl_name(gl_type: int | None) str | int | None[source]

Return the name of a gl type

class arcade.gl.types.AttribFormat(name: str | None, gl_type: int | None, components: int, bytes_per_component: int, offset=0, location=0)[source]

Bases:

Represents a vertex attribute in a BufferDescription / Program. This is attribute metadata used when attempting to map vertex shader inputs.

Parameters:
  • name – Name of the attribute

  • gl_type – The OpenGL type such as GL_FLOAT, GL_HALF_FLOAT etc.

  • bytes_per_component – Number of bytes for a single component

  • offset – Offset for BufferDescription

  • location – Location for program attribute

name

The name of the attribute in the program

gl_type

The OpenGL type of the attribute

components

Number of components for this attribute (1, 2, 3 or 4)

bytes_per_component

How many bytes for a single component

offset

Offset of the attribute in the buffer

location

Location of the attribute in the program

property bytes_total: int

Total number of bytes for this attribute

class arcade.gl.types.TypeInfo(name: str, enum: c_uint | int, gl_type: int, gl_size: int, components: int)[source]

Bases:

Describes an opengl type.

Parameters:
  • name – The string representation of this type

  • enum – The enum of this type

  • gl_type – The base enum of this type

  • gl_size – byte size if the gl_type

  • components – Number of components for this enum

name

The string representation of this type

enum

The OpenEL enum of this type

gl_type

The base OpenGL data type

gl_size

The size of the base OpenGL data type

components

The number of components (1, 2, 3 or 4)

property size: int

The total size of this type in bytes

class arcade.gl.types.GLTypes[source]

Bases:

Detailed Information about all attribute type.

During introspection we often just get integers telling us what type is used. This can for example be 35664 telling us it’s a GL_FLOAT_VEC2.

During introspection we need to know the exact datatype of the attribute. It’s not enough to know it’s a float, we need to know if it’s a vec2, vec3, vec4 or any other type that OpenGL supports.

Examples of types are:

GL_FLOAT_VEC2
GL_DOUBLE_VEC4
GL_INT_VEC3
GL_UNSIGNED_INT_VEC2
GL_UNSIGNED_BYTE
GL_FLOAT
GL_DOUBLE
GL_INT
GL_UNSIGNED_INT
...
types = {5120: <TypeInfo name=GL_BYTE, enum=5120 gl_type=5120 gl_size=1 components=1>, 5121: <TypeInfo name=GL_UNSIGNED_BYTE, enum=5121 gl_type=5121 gl_size=1 components=1>, 5123: <TypeInfo name=GL.GL_UNSIGNED_SHORT, enum=5123 gl_type=5123 gl_size=2 components=2>, 5124: <TypeInfo name=GL_INT, enum=5124 gl_type=5124 gl_size=4 components=1>, 5125: <TypeInfo name=GL_UNSIGNED_INT, enum=5125 gl_type=5125 gl_size=4 components=1>, 5126: <TypeInfo name=GL_FLOAT, enum=5126 gl_type=5126 gl_size=4 components=1>, 5130: <TypeInfo name=GL_DOUBLE, enum=5130 gl_type=5130 gl_size=8 components=1>, 35664: <TypeInfo name=GL_FLOAT_VEC2, enum=35664 gl_type=5126 gl_size=4 components=2>, 35665: <TypeInfo name=GL_FLOAT_VEC3, enum=35665 gl_type=5126 gl_size=4 components=3>, 35666: <TypeInfo name=GL_FLOAT_VEC4, enum=35666 gl_type=5126 gl_size=4 components=4>, 35667: <TypeInfo name=GL_INT_VEC2, enum=35667 gl_type=5124 gl_size=4 components=2>, 35668: <TypeInfo name=GL_INT_VEC3, enum=35668 gl_type=5124 gl_size=4 components=3>, 35669: <TypeInfo name=GL_INT_VEC4, enum=35669 gl_type=5124 gl_size=4 components=4>, 35670: <TypeInfo name=GL_BOOL, enum=35670 gl_type=35670 gl_size=1 components=1>, 35671: <TypeInfo name=GL_BOOL_VEC2, enum=35671 gl_type=35670 gl_size=1 components=2>, 35672: <TypeInfo name=GL_BOOL_VEC3, enum=35672 gl_type=35670 gl_size=1 components=3>, 35673: <TypeInfo name=GL_BOOL_VEC4, enum=35673 gl_type=35670 gl_size=1 components=4>, 35674: <TypeInfo name=GL_FLOAT_MAT2, enum=35674 gl_type=5126 gl_size=4 components=4>, 35675: <TypeInfo name=GL_FLOAT_MAT3, enum=35675 gl_type=5126 gl_size=4 components=9>, 35676: <TypeInfo name=GL_FLOAT_MAT4, enum=35676 gl_type=5126 gl_size=4 components=16>, 35685: <TypeInfo name=GL_FLOAT_MAT2x3, enum=35685 gl_type=5126 gl_size=4 components=6>, 35686: <TypeInfo name=GL_FLOAT_MAT2x4, enum=35686 gl_type=5126 gl_size=4 components=8>, 35687: <TypeInfo name=GL_FLOAT_MAT3x2, enum=35687 gl_type=5126 gl_size=4 components=6>, 35688: <TypeInfo name=GL_FLOAT_MAT3x4, enum=35688 gl_type=5126 gl_size=4 components=12>, 35689: <TypeInfo name=GL_FLOAT_MAT4x2, enum=35689 gl_type=5126 gl_size=4 components=8>, 35690: <TypeInfo name=GL_FLOAT_MAT4x3, enum=35690 gl_type=5126 gl_size=4 components=12>, 36294: <TypeInfo name=GL_UNSIGNED_INT_VEC2, enum=36294 gl_type=5125 gl_size=4 components=2>, 36295: <TypeInfo name=GL_UNSIGNED_INT_VEC3, enum=36295 gl_type=5125 gl_size=4 components=3>, 36296: <TypeInfo name=GL_UNSIGNED_INT_VEC4, enum=36296 gl_type=5125 gl_size=4 components=4>, 36678: <TypeInfo name=GL_DOUBLE_MAT2, enum=36678 gl_type=5130 gl_size=8 components=4>, 36679: <TypeInfo name=GL_DOUBLE_MAT3, enum=36679 gl_type=5130 gl_size=8 components=9>, 36680: <TypeInfo name=GL_DOUBLE_MAT4, enum=36680 gl_type=5130 gl_size=8 components=16>, 36681: <TypeInfo name=GL_DOUBLE_MAT2x3, enum=36681 gl_type=5130 gl_size=8 components=6>, 36682: <TypeInfo name=GL_DOUBLE_MAT2x4, enum=36682 gl_type=5130 gl_size=8 components=8>, 36683: <TypeInfo name=GL_DOUBLE_MAT3x2, enum=36683 gl_type=5130 gl_size=8 components=6>, 36684: <TypeInfo name=GL_DOUBLE_MAT3x4, enum=36684 gl_type=5130 gl_size=8 components=12>, 36685: <TypeInfo name=GL_DOUBLE_MAT4x2, enum=36685 gl_type=5130 gl_size=8 components=8>, 36686: <TypeInfo name=GL_DOUBLE_MAT4x3, enum=36686 gl_type=5130 gl_size=8 components=12>, 36860: <TypeInfo name=GL_DOUBLE_VEC2, enum=36860 gl_type=5130 gl_size=8 components=2>, 36861: <TypeInfo name=GL_DOUBLE_VEC3, enum=36861 gl_type=5130 gl_size=8 components=3>, 36862: <TypeInfo name=GL_DOUBLE_VEC4, enum=36862 gl_type=5130 gl_size=8 components=4>}
classmethod get(enum: int) TypeInfo[source]

Get the TypeInfo for a given