Hi guys - I'm drawing a load of lines and I'd really like them to have a lineJoin of "miter" rather than the sharp edges that currently exist. I'm happy to just draw them to a canvas context as I'm only caching the resulting image as a bitmap anyway (so limited performance concerns) and I've seen that you already have this available when working with text so was hoping it would be a quick fix ;-)
Any more info that you need, please just ask :)
N
Thick lines can be tricky in WebGL. Things like triangle orientation, sharp miters, anti-aliasing, end caps, etc all tend to complicate the code. Eventually it would be cool if there was some shared modules in this space so that ThreeJS/stackgl/etc could take advantage.
If you want an easy approach that is pure WebGL (i.e. no 2D canvas), you can use the polyline-normals module. Given a set of 2D points, it will give you the normals and miter lengths for those points. From this you could create your own polygon with PIXI.Graphics.
Some references in case anybody wants to tackle this:
http://mattdesl.svbtle.com/drawing-lines-is-hard
https://github.com/stackgl/contributing/issues/25
Thanks for the comments and links :) Unfortunately a WebGL only approach isn't an option and TBH would be OTT for my case - I'd actually far rather just render to canvas and then modularise the PIXI cacheAsBitmap code to work (I'm using PIXI to avoid dealing with WebGL ;-) !) just for my use case.
Nice blog BTW but I don't agree with your comments about semi-colons ;-)
+1
+1
Very much appreciated if this will be in the lib. I'm drawing a lot of lines and curves on a project rightnow with PIXI and they don't look nice with sharp edges. Nice to see it's got the v5 tag! Looking forward to this.
TBF, it's had a v3, v4 and a v5 tag ;-) (that's honestly not a criticism guys, I'm just messing with you :) !)
wait
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Should not be stale/closed, referenced in the documentation.
Most helpful comment
+1
Very much appreciated if this will be in the lib. I'm drawing a lot of lines and curves on a project rightnow with PIXI and they don't look nice with sharp edges. Nice to see it's got the v5 tag! Looking forward to this.