BaseCollection

class glumpy.graphics.collections.BaseCollection(vtype, utype=None, itype=None)

Bases: object

A collection is a container for several (optionally indexed) objects having the same vertex structure (vtype) and same uniforms type (utype). A collection allows to manipulate objects individually and each object can have its own set of uniforms provided they are a combination of floats because they are internally stored into a texture can be retrieved from within the shader using a specific code (fetchcode).

Parameters:
  • vtype (np.dtype) – Vertex type (mandatory)
  • utype (np.dtype) – Uniform type or None
  • itype (np.dtype) – Index type (np.uint32 or None)
append(vertices, uniforms=None, indices=None, itemsize=None)
Parameters:
  • vertices (numpy array) – An array whose dtype is compatible with self.vdtype
  • uniforms (numpy array) – An array whose dtype is compatible with self.utype
  • indices (numpy array) – An array whose dtype is compatible with self.idtype All index values must be between 0 and len(vertices)
  • itemsize (int, tuple or 1-D array) –

    If itemsize is an integer, N, the array will be divided into elements of size N. If such partition is not possible, an error is raised.

    If itemsize is 1-D array, the array will be divided into elements whose succesive sizes will be picked from itemsize. If the sum of itemsize values is different from array size, an error is raised.

itype

Indices dtype

utype

Uniforms dtype

vtype

Vertices dtype