Does love.graphics.line draw a triangle?
Posted: Sun Jun 21, 2020 1:59 am
I've been experimenting with 3d graphics stuff using shaders, and i've made a fair amount of progress. Recently, I tried to give my 3d shapes an outline. I've tried to use love.graphics.setWireframe and then draw my shape on top of it (the lines were too thin), I've tried using love.graphics.line with 3 points (produced weird effects), and I naively tried using love.graphics.polygon with "line" instead of "fill" (produced even weirder effects).
Finally, I decided to draw a line using love.graphics.line for each side of the shape I'm trying to outline, only giving 2 points this time. This produces a triangle with a white-to-black gradient, which surprised me because I thought I was only passing 2 vertices to my shader instead of 3. Maybe I'm doing this wrong, but here's my explanation:
love.graphics.line doesn't actually draw lines, but triangles, where the 3rd vertex cannot be seen. Applying certain transformations to these 3 points can allow you to see this 3rd vertex, as openGL will attempt to interpolate between the two given vertices and this 3rd vertex. Personal theories aside, is there any way to draw a line that's immune from being transformed this way?
Thanks for any help you can give.
Finally, I decided to draw a line using love.graphics.line for each side of the shape I'm trying to outline, only giving 2 points this time. This produces a triangle with a white-to-black gradient, which surprised me because I thought I was only passing 2 vertices to my shader instead of 3. Maybe I'm doing this wrong, but here's my explanation:
love.graphics.line doesn't actually draw lines, but triangles, where the 3rd vertex cannot be seen. Applying certain transformations to these 3 points can allow you to see this 3rd vertex, as openGL will attempt to interpolate between the two given vertices and this 3rd vertex. Personal theories aside, is there any way to draw a line that's immune from being transformed this way?
Thanks for any help you can give.