Error Code 0x505 Cannot create image

Issue #64 resolved
Sla Master created an issue

I get this on my video player script, at end of the video, I tested it before with a shorter video and it ran but with this 1054 frames video doesn't work, works perfect on Windows.

Images are JPG, they're removed after they were rendered, so memory is not a problem (also I have 1 GB RAM on it). Images are sent trough threads to the main thread and then loaded as images into the buffer table.

sometimes it works and doesn't crash, but most of times does.
m is a userdata (Graphic) and checked before using it.
the line where it crashes: SSV.buffer[SSV.framereceive]=love.graphics.newImage(m)

Comments (3)

  1. Alex Szpakowski

    0x505 means OpenGL doesn't have enough video memory to store the new image. Your old images probably aren't being garbage collected as fast as you'd like.

    Instead of creating a new image for every frame in your video, you should just upload new frame's data to the same image each time (using Image:refresh()). Then you'll only ever need a single love.graphics Image for an entire video.

    The code for that might look something like this:

    videoImageData = love.image.newImageData(videowidth, videoheight)
    videoImage = love.graphics.newImage(videoImageData)
    
    function updateVideo(newVideoData)
        videoImageData:paste(newVideoData, 0, 0, 0, 0, newVideoData:getDimensions())
        videoImage:refresh()
    end
    
    function love.update(dt)
        -- updateVideo(...) etc.
    end
    
    function love.draw()
        love.graphics.draw(videoImage, 0, 0)
    end
    
  2. Log in to comment