vispy.visuals.collections.base_collection module

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.

class vispy.visuals.collections.base_collection.BaseCollection(vtype, utype=None, itype=None)[source]

Bases: object

append(vertices, uniforms=None, indices=None, itemsize=None)[source]
Parameters
verticesnumpy array

An array whose dtype is compatible with self.vdtype

uniforms: numpy array

An array whose dtype is compatible with self.utype

indicesnumpy 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.

property itype

Indices dtype

property utype

Uniforms dtype

property vtype

Vertices dtype

class vispy.visuals.collections.base_collection.Item(parent, key, vertices, indices, uniforms)[source]

Bases: object

An item represent an object within a collection and is created on demand when accessing a specific object of the collection.

property indices
property uniforms
property vertices
vispy.visuals.collections.base_collection.next_power_of_2(n)[source]

Return next power of 2 greater than or equal to n