graphics.reset() not fully resetting translation?

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
pmcmorri
Prole
Posts: 3
Joined: Thu Aug 04, 2011 2:27 am

graphics.reset() not fully resetting translation?

Post by pmcmorri »

I'm trying to some pixel based line art with rectangles and have been having trouble getting the lines to land exactly on pixels to avoid blurring. It appears that there is a default translation of (-0.5f, -0.5f). Resetting the graphics does not seem to set things back to the identity either.

Here is a quick way to see the problem (as least on my machine)

-- in love.load()
love.graphics.setMode( 1024, 768, false, true, 0 )

-- in love.draw()
-- love seems to have a default translation?
--love.graphics.translate( 0.5, 0.5 ) -- uncomment to fix the problem
love.graphics.setColor(0xFF, 0x00,0x00, 0xFF)
love.graphics.rectangle("line", 0, 0,1024,768)
love.graphics.setColor(0xFF, 0xFF,0xFF, 0xFF)
love.graphics.rectangle("line", 0, 0,100,100)

If you look carefully (screenshot and zoom in) you'll be able to see the filtering issues that this causes. Then if you uncomment the translation line above and run again the problem goes away.

I did search for issues related to translation and line drawing but failed to find what I was looking for.

Does anyone know if this is a bug or if this is by design?

Thanks,


Patrick
pmcmorri
Prole
Posts: 3
Joined: Thu Aug 04, 2011 2:27 am

Re: graphics.reset() not fully resetting translation?

Post by pmcmorri »

Also, maybe this isn't a matrix problem but with the rectangle code. Adding the 0.5 translation makes my images and fonts look worse. :P
pmcmorri
Prole
Posts: 3
Joined: Thu Aug 04, 2011 2:27 am

Re: graphics.reset() not fully resetting translation?

Post by pmcmorri »

Maybe I'm answering my own questions at this point but for "line" drawing modes, the coordinates would need to indicate the center of the pixel to land exactly and thus would be at 0.5,0.5 for the 0,0 pixel.

Never mind, feel free to lock this thread. :P


Patrick
Post Reply

Who is online

Users browsing this forum: Google [Bot], slime and 2 guests