Friday, November 21, 2014


I have always been interested in drawing lines on the computer. When I was first learning to code on Apple][, hlin and vlin were the fastest drawing commands in town.

On Amiga the Agnus chip needed some careful poking and lines could be drawn in any direction.

In OpenGL commands are available for drawing thick lines with anti aliased edges. 

The lowest common denominator of GL is Angle which won't do thick or anti aliased lines without some shader tricks from the developer.

Output from the code I have been working on:

Each line requires two vertex from which a quad is formed and rotated to face the camera. Features of the system include
  • a minimum width so lines in the distance are still drawn with accuracy
  • anti aliased edges without MSAA
Line direction and length are stored for each vertex and funky shader math added to produce eye facing quads with texture coordinates used to stretch map the following source.

The generous amount of alpha surround produces good antialiasing at all mip levels.
This is a work in progress using mak/gles20cube  as starting point from the monkey-x bananas folder.

I am interested in using a clipping plane at each end so multi segment lines can be drawn with out overlap and adding points with radius to the mix which could form the basis of a new editor project I am slowly formulating.

# skid lines (arrow keys to steer, a and z for up down)

The source code can be found here.