visual glitch on basic animation with 3D desktop

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
lem__mel
Prole
Posts: 2
Joined: Mon Nov 28, 2011 8:44 pm

visual glitch on basic animation with 3D desktop

Post by lem__mel »

Hi the forum,

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
the full snipped code and data (pictures) are available at http://dl.free.fr/rgwswnAsE
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: visual glitch on basic animation with 3D desktop

Post by kikito »

Hi there,

I can't say for sure, but probably using quads instead of a framebuffer should alleviate some of your problems. Quads are (I think) more efficient.
When I write def I mean function.
lem__mel
Prole
Posts: 2
Joined: Mon Nov 28, 2011 8:44 pm

Re: visual glitch on basic animation with 3D desktop

Post by lem__mel »

Sorry I didn't find time to code or to read the forum.

Thanks for the suggestion (not using framebuffer), but I don't think that is a good idea (nevertheless I will test it this week end) because I'm not making any transformation, I'm just displaying a picture.
At first I just drawed the image (a very small one : 45x54, with 256 indexed color) and when I setted the resolution (320x240) and the fullscreen I saw the glitch.

It is not cpu consumming enough to be making optimization, isn't it ? At the very least, I would understand under performance for the OpenGL doing transformation so 2D (convert from my screen resolution to 320x240 - that is not very common and not very today fashion) when by design it handles 3D.

I will test this week end the following things in this order :
- change the pictures resolution in order to be visible enough in great screen resolution: that way it would test if OpenGL does handle small resolutions
- use quad

Have you any other idea ?
Post Reply

Who is online

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