Image vanishes on its own accord

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Image vanishes on its own accord

Post by xXxMoNkEyMaNxXx »

This is an ongoing problem in many of my projects. I go to test something, the test looks good, I leave it running. Poof! Whatever was there is no more and it's a black, empty window of sadness.

Example:
download/file.php?id=7239
(From viewtopic.php?f=5&t=29865)

It's a problem with what I'm currently working on too, but it's more severe. I have no idea why this happens. Please ask for more if you need it.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Image vanishes on its own accord

Post by Boolsheet »

This is an issue in LÖVE. You have to keep a reference to the Image around or the garbage collector will collect it and the shader is sad that his image disappeared.

For example the line where you load the image. If you mark the sky variable as a local, then Lua doesn't need it anymore once main.lua is loaded and throws it away. Try making the sky variable a global so it will keep the reference.

Code: Select all

sky=love.graphics.newImage'Skymap.png'
Shallow indentations.
User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: Image vanishes on its own accord

Post by xXxMoNkEyMaNxXx »

Thank you grandly. One of my attempts to fix this was to call the garbage collector xD

My project is a perfect image offset rotate + scale -- colouring the pixels using a weighted average the based on the area of intersection with the pixel being rendered. It is totally over the top, a.k.a. my style. However, I'm hoping that it will be stunning when I finish it, because I've had the idea for quite some time.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 8 guests