Page 1 of 1

create multiple lines with one function

Posted: Sat Dec 03, 2016 8:16 pm
by cemcmd
I want to create multiple lines from constantly changing X and Y variables. But I can not figure out how to create more than 1 line other than to use more than 1 "love.graphics.line" function.

Re: create multiple lines with one function

Posted: Sat Dec 03, 2016 9:51 pm
by s-ol
1. there is nothing wrong with calling love.graphics.line multiple times.
2. you can give more than two coordinate pairs to love.graphics.line to create a continuous line with more than one segment (see wiki page example)
3. if you draw a lot of lines you can theoreticall create a mesh to draw them, but it's quite complicated since you need to turn every line into at least two triangles and add those vertices to the Mesh.

Re: create multiple lines with one function

Posted: Sat Dec 03, 2016 11:15 pm
by Jasoco
Löve can draw thousands of objects per frame without getting anywhere close to going lower than 60FPS. You don't need to be afraid to draw a lot of objects.