textures.Textures

moderngl_window.resources.textures.Textures[source]

Handles texture resources

Methods

Textures.__init__()

Initialize internal attributes

Textures.load(meta: moderngl_window.meta.texture.TextureDescription) → Union[moderngl.texture.Texture, moderngl.texture_array.TextureArray][source]

Loads a texture with the configured loaders.

Parameters

meta (TextureDescription) – The resource description

Returns

2d texture

Return type

moderngl.Texture

Returns

texture array if layers is supplied

Return type

moderngl.TextureArray

Textures.add(meta: moderngl_window.meta.base.ResourceDescription) → None

Adds a resource description without loading it. The resource is loaded and returned when load_pool() is called.

Parameters

meta (ResourceDescription) – The resource description

Textures.load_pool() → Generator[Tuple[moderngl_window.meta.base.ResourceDescription, Any], None, None]

Loads all the data files using the configured finders.

This is only relevant when resource have been added to this pool using add().

Returns

Generator of (meta, resource) tuples

Textures.resolve_loader(meta: moderngl_window.meta.base.ResourceDescription) → None

Attempts to assign a loader class to a ResourceDescription.

Parameters

meta (ResourceDescription) – The resource description instance

Attributes

Textures.settings_attr = 'TEXTURE_LOADERS'
Textures.count

The number of resource descriptions added. This is only relevant when using add and load_pool.

Type

int

Textures.loaders

Loader classes for this resource type

Type

Generator