Straight line between two points (shader)

Hey,

just started getting to know them shaders a little bit and I’m already pretty lost I think. I haven’t found a really good “beginners” tutorial using google-foo either. The basic problem I try to solve now is drawing a line between two points in the fragment shader. It’s not really what I want to do in the end, but once I solve that I guess I can figure the rest out, or rather I hope to.

So, using a “standard” vertex passthrough shader I have point A vectorStart, and point B vectorEnd which I pass as uniform to the fragment shader.

Now I understand that the fragment shader runs for every pixel on the screen, I hope that’s right.

How do I do the


if gl_FragCoord == isOnTheWayBetweenPointAandPointB {
 make it blue }

How do I find out the “isOnTheWayBetween” thing? :smiley:
It’s probably more of a math question, but I also suck at that :smiley:

But maybe there is an easy way to solve this? Thanks guys :slight_smile: