Canvases and thin lines.
Posted: Wed Aug 13, 2014 1:56 pm
So i'm trying to draw some lines in a grid formation to a canvas. But i'm having some problems.
A picture is worth a thousand words.
Screenshot is from my recent bloomy game of life implementation. The current version that's on the forum post isn't affected though, But i changed the resolution, and the cell size and it started happening.
For testing purposes i quickly threw together a function that generates one of these grids and returns a canvas.
And from my testing i've found this only/mostly happens when the line width is 1. And i kinda need the line width to be 1. Is there a way to do this with a canvas or should i just draw some lines with loops?
I do have shaders in the thing i'm making this for, But this doesn't need to be affected by them.
A picture is worth a thousand words.
Screenshot is from my recent bloomy game of life implementation. The current version that's on the forum post isn't affected though, But i changed the resolution, and the cell size and it started happening.
For testing purposes i quickly threw together a function that generates one of these grids and returns a canvas.
Code: Select all
function create_grid(width, height, color, line_width, cell_size)
local ow = love.graphics.getLineWidth()
local c = love.graphics.newCanvas(width * cell_size, height * cell_size)
love.graphics.setCanvas(c)
love.graphics.setColor(color)
love.graphics.setLineWidth(line_width)
love.graphics.setLineStyle("rough")
for y=1, height do
love.graphics.line(0, y * cell_size, width * cell_size, y * cell_size)
end
for x=1, width do
love.graphics.line(x * cell_size, 0, x * cell_size, height * cell_size)
end
love.graphics.setCanvas()
love.graphics.setLineWidth(ow)
return c
end
I do have shaders in the thing i'm making this for, But this doesn't need to be affected by them.