self:set_filter
Client
Sets the sampling filter of the texture
Syntax
local status = self:set_filter(
mode
)Mipmap-based filters require the texture to already have a mipmap chain — no chain is generated on demand.NEAREST_MIPMAP, LINEAR_MIPMAP, and their ANISOTROPIC variants throw if the texture was created without mipmaps.
- Generating mipmaps — pass
mipmaps = truetocore.texture.createupfront. - Survives format changes —
self:convertandself:compressupdate the texture in place, so filter override stays applied.
Parameters
| Type | Name | Description |
|---|---|---|
core.texture.texture_filter | mode | Sampling filter to apply |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, false otherwise |
Examples
local entity = core.texture.create("assets/tiles/grass0.png")
entity:set_filter(core.texture.texture_filter.NEAREST)local entity = core.texture.create("assets/sprite.png")
entity:set_filter(core.texture.texture_filter.NEAREST)
entity:set_filter(core.texture.texture_filter.DEFAULT)local entity = core.texture.create("assets/terrain/cliff_diffuse.png", true)
entity:set_filter(core.texture.texture_filter.LINEAR_MIPMAP_ANISOTROPIC)local entity = core.texture.create("assets/terrain/cliff_diffuse.png", true)
entity:set_filter(core.texture.texture_filter.LINEAR_MIPMAP)
entity:compress(core.texture.compression_mode.BPTC)