Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Save a noise to a texture! thanks Positive07
local data = love.image.newImageData(w, h)
data:mapPixel(function(x,y,r,g,b,a)
local a = love.math.noise(x, y)
return a, a, a, 1
end)
if isSaveIt then
data:encode("png", filename or "noise.png")
local image = love.graphics.newImage(data)
return image
else
return data
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment