SetFilter

Sets the filter mode of a texture.

Syntax

Parameters

Example

window = Window:Create()
context = Context:Create(window)

--Load a texture
texture1 = Texture:Load("Materials/Nature/mountain_snow.tex")

--Set texture filter
texture1:SetFilter(Texture.Smooth)

--Load a new unique copy of the same texture
texture2 = Texture:Load("Materials/Nature/mountain_snow.tex",Asset.Unmanaged)

--Set texture filter
texture2:SetFilter(Texture.Pixel)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

context:SetColor(0,0,0)
context:Clear()

--Display the textures on screen so we can compare the difference
context:SetColor(1,1,1)
context:DrawImage(texture1,0,0,4096,4096)
context:DrawImage(texture2,256,256,4096,4096)

context:SetBlendMode(Blend.Alpha)
context:DrawText("Smooth filter ("..texture1:GetFilter()..")",0,0)
context:DrawText("Pixel filter ("..texture2:GetFilter()..")",256,256)
context:SetBlendMode(Blend.Solid)

context:Sync()
end