Difference between revisions of "(Image):setMipmapFilter"

m (Added notice about more driver bugs)
m (Updated for 0.10.0)
Line 4: Line 4:
 
[http://en.wikipedia.org/wiki/Mipmap Mipmapping] is useful when drawing an image at a reduced scale. It can improve performance and reduce aliasing issues.
 
[http://en.wikipedia.org/wiki/Mipmap Mipmapping] is useful when drawing an image at a reduced scale. It can improve performance and reduce aliasing issues.
  
{{notice|It's best to call this method directly after creating the image with [[love.graphics.newImage]], to avoid bugs in certain graphics drivers.}}
+
In [[0.10.0]] and newer, the Image must be [[love.graphics.newImage|created]] with the <code>mipmaps</code> flag enabled for the mipmap filter to have any effect.
  
{{notice|Due to hardware restrictions and driver bugs, images that weren't loaded from a [[CompressedData]] must have power-of-two dimensions (64x64, 512x256, etc.) to support mipmaps and mipmap filtering.}}
+
{{notice|In versions prior to [[0.10.0]] it's best to call this method directly after creating the image with [[love.graphics.newImage]], to avoid bugs in certain graphics drivers.}}
 +
 
 +
{{notice|Due to hardware restrictions and driver bugs, in versions prior to [[0.10.0]] images that weren't loaded from a [[CompressedData]] must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps.}}
  
 
== Function ==
 
== Function ==
Automatically creates mipmaps for the Image if none exist yet. If the image is [[(Image):isCompressed|compressed]] and its [[CompressedData]] has mipmap data included, it will use that.
 
 
=== Synopsis ===
 
=== Synopsis ===
 
<source lang="lua">
 
<source lang="lua">
Line 19: Line 20:
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
=== Notes ===
 +
On mobile devices (Android and iOS), the sharpness parameter is not supported and will do nothing. You can use a custom [[Shader]] instead, and specify the mipmap sharpness in the optional third parameter to the <code>Texel</code> function in the shader (a ''negative'' value makes the image use a more detailed mipmap level.)
 +
 +
In versions prior to [[0.10.0]], calling this function automatically creates mipmaps for the Image if none exist yet. If the image is [[(Image):isCompressed|compressed]] and its [[CompressedData]] has mipmap data included, it will use that.
  
 
== Function ==
 
== Function ==

Revision as of 05:55, 26 November 2015

Available since LÖVE 0.9.0
This function is not supported in earlier versions.

Sets the mipmap filter mode for an Image.

Mipmapping is useful when drawing an image at a reduced scale. It can improve performance and reduce aliasing issues.

In 0.10.0 and newer, the Image must be created with the mipmaps flag enabled for the mipmap filter to have any effect.

O.png In versions prior to 0.10.0 it's best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers.  


O.png Due to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren't loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps.  


Function

Synopsis

Image:setMipmapFilter( filtermode, sharpness )

Arguments

FilterMode filtermode
The filter mode to use in between mipmap levels. "nearest" will often give better performance.
number sharpness (0)
A positive sharpness value makes the image use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse.

Returns

Nothing.

Notes

On mobile devices (Android and iOS), the sharpness parameter is not supported and will do nothing. You can use a custom Shader instead, and specify the mipmap sharpness in the optional third parameter to the Texel function in the shader (a negative value makes the image use a more detailed mipmap level.)

In versions prior to 0.10.0, calling this function automatically creates mipmaps for the Image if none exist yet. If the image is compressed and its CompressedData has mipmap data included, it will use that.

Function

Disables mipmap filtering.

Synopsis

Image:setMipmapFilter( )

Arguments

None.

Returns

Nothing.

See Also

Other Languages