I'm trying to create some textures from code, and noticed some strange behaviour.
Please look at [1] and [2] lines of my code. With image:refresh() [2] code works fine on Windows and on MacOS, but with love.graphics.newImage(...) [1] in Windows works fine, but in MacOS it causes memory leak and then crash love http://monosnap.com/image/n8oHMiVtuUFyi ... DnLzcEtUif
Note: I have love 0.9.1. Image:refresh() is the great method, but in some cases creating new images would be more convenient...
Can anyone help me please? (:
Code: Select all
function love.load()
w = 512
h = 512
love.window.setMode(w, h, {resizable=false, vsync=false})
imageData = love.image.newImageData(w, h)
image = love.graphics.newImage(imageData)
end
function love.update(dt)
for i = 0, w-1 do
for j = 0, h-1 do
imageData:setPixel(i, j, 255, 255, 255, math.random(0, 255))
end
end
image = love.graphics.newImage(imageData) -- [1] memory leak?
-- image:refresh() -- [2] works fine
end
function love.draw()
love.window.setTitle("fps " .. love.timer.getFPS())
love.graphics.draw(image, 0, 0)
end