Drawing Lines is Hard
Drawing lines might not sound like rocket science, but it’s damn difficult to do well in OpenGL, particularly WebGL. Here I explore a few different techniques for 2D and 3D line rendering, and accompany each with a small canvas demo.
Source for demos can be found here:
WebGL includes support for lines with
gl.LINE_LOOP. Sounds great, right? Not really. Here are just a few issues with that:
- Drivers may implement the rendering/filtering slightly differently, and you may not get a consistent render across devices or browsers
- The maximum line width is driver-dependent. Users running ANGLE, for example, will get a maximum of 1.0, which is pretty useless. On my new Yosemite machine, line width maxes out at about 10.
- No control over line join or end cap styles
- MSAA is not...
Continue reading →