Module ncine.texture
The table containing texture related functions
Functions
ncine.texture.new (filename) | Constructs a texture object from an image file. |
ncine.texture.new_init (name, format, mip_count, size) | Constructs a blank texture. |
ncine.texture.new_init (name, format, mip_count, x, y) | Constructs a blank texture. |
ncine.texture.delete (texture) | Destroys a texture object and releases its memory |
ncine.texture.init (texture, name, format, mip_count, size) | Initializes a texture object to a blank texture |
ncine.texture.init (texture, name, format, mip_count, x, y) | Initializes a texture object to a blank texture |
ncine.texture.get_width (texture) | Returns the texture width |
ncine.texture.get_height (texture) | Returns the texture height |
ncine.texture.mip_levels (texture) | Returns the number of MIP map levels |
ncine.texture.is_compressed (texture) | Returns true if the texture holds compressed data |
ncine.texture.get_format (texture) | Returns the texture format |
ncine.texture.num_channels (texture) | Returns the number of color channels |
ncine.texture.datasize (texture) | Returns the amount of video memory needed to load the texture |
ncine.texture.get_min_filtering (texture) | Returns the filtering mode used for minification |
ncine.texture.get_mag_filtering (texture) | Returns the filtering mode used for magnification |
ncine.texture.get_wrap (texture) | Returns the wrap mode used for the s and t directions |
ncine.texture.set_min_filtering (texture, filtering) | Sets the filtering mode used for minification |
ncine.texture.set_mag_filtering (texture, filtering) | Sets the filtering mode used for magnification |
ncine.texture.set_wrap (texture, wrap) | Sets the wrap mode used for the s and t directions |
ncine.texture.is_chromakey_enabled (texture) | Returns true if chroma key transparency will be used when loading |
ncine.texture.get_chromakey_color (texture) | Returns the color treated as transparent when loading a texture |
ncine.texture.set_chromakey_enabled (texture, state) | Sets the chroma key transparency state to use when loading |
ncine.texture.set_chromakey_color (texture, color) | Sets the color to be treated as transparent when loading a texture through a ncine.color table |
ncine.texture.set_chromakey_color (texture, r, g, b, a) | Sets the color to be treated as transparent when loading a texture through color components |
ncine.texture.set_gltexture_label (texture, label) | Sets the OpenGL object label for the texture |
Tables
textureObj | The light user data of a texture object |
ncine.tex_format | Texture formats (enumeration) |
ncine.tex_filtering | Texture filtering modes (enumeration) |
ncine.tex_wrap | Texture wrap modes (enumeration) |
Functions
- ncine.texture.new (filename)
-
Constructs a texture object from an image file.
Don’t forget to call ncine.texture.delete when you are done with it!
Parameters:
- filename string The path to an image file
Returns:
-
textureObj
A new texture object
- ncine.texture.new_init (name, format, mip_count, size)
-
Constructs a blank texture.
Don’t forget to call ncine.texture.delete when you are done with it!
Parameters:
- name string The name for the new texture object
- format ncine.tex_format The texture format
- mip_count integer The number of MIP map levels
- size ncine.vec2 The texture size
Returns:
-
textureObj
A new texture object
- ncine.texture.new_init (name, format, mip_count, x, y)
-
Constructs a blank texture.
Don’t forget to call ncine.texture.delete when you are done with it!
Parameters:
- name string The name for the new texture object
- format ncine.tex_format The texture format
- mip_count integer The number of MIP map levels
- x integer The texture width
- y integer The texture height
Returns:
-
textureObj
A new texture object
- ncine.texture.delete (texture)
-
Destroys a texture object and releases its memory
Parameters:
- texture textureObj The texture object to be destroyed
- ncine.texture.init (texture, name, format, mip_count, size)
-
Initializes a texture object to a blank texture
Parameters:
- texture textureObj
- name string The name for the new texture object
- format ncine.tex_format The texture format
- mip_count integer The number of MIP map levels
- size ncine.vec2 The texture size
- ncine.texture.init (texture, name, format, mip_count, x, y)
-
Initializes a texture object to a blank texture
Parameters:
- texture textureObj
- name string The name for the new texture object
- format ncine.tex_format The texture format
- mip_count integer The number of MIP map levels
- x integer The texture width
- y integer The texture height
- ncine.texture.get_width (texture)
-
Returns the texture width
Parameters:
- texture textureObj
Returns:
-
integer
- ncine.texture.get_height (texture)
-
Returns the texture height
Parameters:
- texture textureObj
Returns:
-
integer
- ncine.texture.mip_levels (texture)
-
Returns the number of MIP map levels
Parameters:
- texture textureObj
Returns:
-
integer
- ncine.texture.is_compressed (texture)
-
Returns
true
if the texture holds compressed dataParameters:
- texture textureObj
Returns:
-
boolean
- ncine.texture.get_format (texture)
-
Returns the texture format
Parameters:
- texture textureObj
Returns:
-
ncine.tex_format
- ncine.texture.num_channels (texture)
-
Returns the number of color channels
Parameters:
- texture textureObj
Returns:
-
integer
- ncine.texture.datasize (texture)
-
Returns the amount of video memory needed to load the texture
Parameters:
- texture textureObj
Returns:
-
integer
- ncine.texture.get_min_filtering (texture)
-
Returns the filtering mode used for minification
Parameters:
- texture textureObj
Returns:
-
ncine.tex_filtering
- ncine.texture.get_mag_filtering (texture)
-
Returns the filtering mode used for magnification
Parameters:
- texture textureObj
Returns:
-
ncine.tex_filtering
- ncine.texture.get_wrap (texture)
-
Returns the wrap mode used for the
s
andt
directionsParameters:
- texture textureObj
Returns:
-
ncine.tex_wrap
- ncine.texture.set_min_filtering (texture, filtering)
-
Sets the filtering mode used for minification
Parameters:
- texture textureObj
- filtering ncine.tex_filtering
- ncine.texture.set_mag_filtering (texture, filtering)
-
Sets the filtering mode used for magnification
Parameters:
- texture textureObj
- filtering ncine.tex_filtering
- ncine.texture.set_wrap (texture, wrap)
-
Sets the wrap mode used for the
s
andt
directionsParameters:
- texture textureObj
- wrap ncine.tex_wrap
- ncine.texture.is_chromakey_enabled (texture)
-
Returns
true
if chroma key transparency will be used when loadingParameters:
- texture textureObj
Returns:
-
boolean
- ncine.texture.get_chromakey_color (texture)
-
Returns the color treated as transparent when loading a texture
Parameters:
- texture textureObj
Returns:
-
ncine.color
- ncine.texture.set_chromakey_enabled (texture, state)
-
Sets the chroma key transparency state to use when loading
Parameters:
- texture textureObj
- state boolean
- ncine.texture.set_chromakey_color (texture, color)
-
Sets the color to be treated as transparent when loading a texture through a
ncine.color
tableParameters:
- texture textureObj
- color ncine.color
- ncine.texture.set_chromakey_color (texture, r, g, b, a)
-
Sets the color to be treated as transparent when loading a texture through color components
Parameters:
- texture textureObj
- r number
- g number
- b number
- a number
- ncine.texture.set_gltexture_label (texture, label)
-
Sets the OpenGL object label for the texture
Parameters:
- texture textureObj
- label string
Tables
- textureObj
- The light user data of a texture object
- ncine.tex_format
-
Texture formats (enumeration)
Fields:
- R8
- RG8
- RGB8
- RGBA8
- UNKNOWN
- ncine.tex_filtering
-
Texture filtering modes (enumeration)
Fields:
- NEAREST
- LINEAR
- NEAREST_MIPMAP_NEAREST
- LINEAR_MIPMAP_NEAREST
- NEAREST_MIPMAP_LINEAR
- LINEAR_MIPMAP_LINEAR
- ncine.tex_wrap
-
Texture wrap modes (enumeration)
Fields:
- CLAMP_TO_EDGE
- MIRRORED_REPEAT
- REPEAT