natiny.texture.create
Lua
natiny.texture.create(resource) -> texture
Creates a texture from an image resource.
Parameters
| Name |
Type |
Description |
resource |
number |
Resource handle containing encoded image data |
Returns
| Type |
Description |
number |
Texture handle |
Example
Lua
local texture = natiny.texture.create(image_resource)
Notes
- Supports JPEG, PNG, TGA, BMP, PSD composite images, GIF, Radiance HDR, PIC
and binary PNM. For GIF images, only the first frame is loaded.
- Raises an error if the image cannot be decoded or the texture cannot be
created.
- Image data is copied, so the resource can be destroyed after this call.
- A complete mip chain is generated. Select its filtering with
natiny.material.set_texture.