Pass:setSampler

Edit

Sets the default Sampler to use when sampling textures. It is also possible to send a custom sampler to a shader using Pass:send and use that instead, which allows customizing the sampler on a per-texture basis.



Arguments

NameTypeDefaultDescription
filterFilterMode'linear' The default filter mode to use when sampling textures (the repeat wrap mode will be used).

Returns

Nothing

Arguments

NameTypeDescription
samplerSampler The default sampler shaders will use when reading from textures.

Returns

Nothing

Notes

The getPixel shader helper function will use this sampler.

When a Pass is reset, its sampler will be reset to linear.

The sampler applies to all draws in the pass on submit, regardless of when the sampler is set.

Example

function lovr.draw(pass)
  pass:setSampler('nearest') -- activate minecraft mode
  pass:setMaterial(rock)
  pass:cube(x, y, z)
end

See also