Here's the code to reproduce the problem:
Code: Select all
function love.load()
-- initialize canvas
local locations = 20
width, height = 200, 200
canvas = love.graphics.newCanvas(width, height)
love.graphics.setCanvas(canvas)
for x = 1, width do
for y = 1, height do
love.graphics.setColor(0.7, 0.7, 0.7)
love.graphics.points(x, y)
end
end
love.graphics.setCanvas()
-- randomize locations
towns = {}
for i = 1, locations do
towns[i] = {x=love.math.random(2, width-1), y=love.math.random(2, height-1)}
end
-- set player to a random location
local i = love.math.random(1, #towns)
player = {x=towns[i].x, y=towns[i].y}
end
function love.draw()
-- reset graphics
love.graphics.setColor(1, 1, 1)
-- draw canvas
love.graphics.draw(canvas, 1, 1)
-- draw player
love.graphics.setColor(1, 1, 1)
love.graphics.rectangle("fill", player.x - 1, player.y - 1, 3, 3)
-- draw towns
love.graphics.setColor(0, 0, 0)
for i = 1, #towns do
love.graphics.points(towns[i].x, towns[i].y) -- This SHOULD be correct
--~ love.graphics.points(towns[i].x+1, towns[i].y) -- This works on my Home PC
--~ love.graphics.points(towns[i].x, towns[i].y+1) -- This works on my Work PC
end
end
The problem is that the town pixels are misaligned. On my home PC, they get shifted to the left 1 pixel. On my work PC, they're shifted up 1 pixel. Both computers are Linux Mint XFCE with all updates installed, and both are running Love 11.3. The hardware is different between them, which shouldn't matter.
Does anyone else get a weird pixel shift? Is there something in my code that I'm not seeing? Is this a Love bug, or is it more likely to be a driver issue? I've attached screenshots of what I'm seeing in case that's helpful.