3.7.1 array type

gles module defines array type for representing numerical data of specific GL type. array objects are convenient when numerical data for OpenGL ES calls is specified in Python code. Class array also defines the standard Python sequence methods so its instances can be iterated and individual items in arrays can be manipulated easily.

class array( type, dimension, sequence)
Constructs a new array object that contains the given type of data that is taken from sequence. Parameter dimension specifies how many items there are in each array element. The dimension information is stored with the array and is used by those functions that need to know the element size of the input data, for example, if colors are specified with three or four components. The dimension does not affect the length of an array or its indexing: both are based on individual items.

Value of type must be one of the following: GL_FLOAT, GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, or GL_FIXED.

The data in sequence is flattened before it is used to fill the array. When type is GL_FLOAT, the sequence can contains floats or integers. With all other types, sequence must only contain integers. Values in sequence are casted in C to the requested type, so if the requested type cannot properly represent all the values the results can be unexpected.

__len__( )
Returns the number of items in the array. Note that array dimension does not affect the calculation of the length.

__getitem__( index)
Returns the item in array with index. Note that array dimension does not affect indexing.

__setitem__( index, value)
Sets the value of the item in position index to value. Note that array dimension does not affect indexing.

See About this document... for information on suggesting changes.