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.
Does love.graphics.line draw a triangle?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Does love.graphics.line draw a triangle?
I don't have experience with 3D graphics, but here are some observations after some testing...
Anyway, to have full control over how your lines are drawn you should probably either draw rectangles or use your own meshes.
- The gradient is from opaque white to transparent white - not to black.
- Doing color.a=1; in the fragment shader gets rid of the gradient and makes the whole triangle opaque white.
- Calling love.graphics.setLineStyle("rough") makes the triangle invisible.
Anyway, to have full control over how your lines are drawn you should probably either draw rectangles or use your own meshes.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Who is online
Users browsing this forum: Google [Bot] and 7 guests