I'm currently testing Löve and I was trying to do some animation ; being an old aventure gamer I used some sprites from Monkey Island II, sprites that require small screen resolution in order to be correctly visible (i.e. 320x240).
I made some code, all seems perfect but when I set the fullscreen I get some visual glitch: it seems that Löve is slow and I see a latency in the refresh. To be precise I get those glitch when I have activate the 3D features of my desktop.
So my questions:
- knowing that Löve use OpenGL as a subsystem, knowing that other 3D application runs correctly (e.g. Open Free Space, Bread, etc), is there a problem in the way that I manage the refresh ?
- why do I have to refresh a sprite so often (each time that draw is called) when I need only to change the scene every 10ms ?
P.S.:
- I'm under Linux with Nvidia drivers ; my desktop is KDE
- some test code:
Code: Select all
guy_marche={} --used to stock the pictures
current=1 --used in order to stock the current frame number
time=0 --a crude timer
imagePos={0,0} --used in order to stock a frame position on screen
function love.load()
love.graphics.toggleFullscreen( )
for i=1,6 do
guy_marche[i-1]=love.graphics.newImage("guybrush/guy_marche"..i..".png")
end
fb = love.graphics.newFramebuffer(320, 240)
end
function love.update(dt)
if time >10 then -- changing the frame every 10ms
--since time has come to change the frame, we reset the "timer"
time=0
--calculating next frame number
current = current+1
current = current%6
--calculating next position on screen
if imagePos[1] > 320 then imagePos[1] = -50 end
imagePos[1] = imagePos[1]+10
--making render into the framebuffer
love.graphics.setRenderTarget(fb)
love.graphics.draw(guy_marche[current], imagePos[1], imagePos[2])
love.graphics.setRenderTarget()
end
-- trying to keep count of the ever fleeing time
time = time + math.floor (dt*100)
if love.keyboard.isDown("escape") then love.event.push('q') end
end
function love.draw()
love.graphics.setColor(255,255,255)
love.graphics.draw(fb, 0, 0)
end