it's a product of frustration since things tend to be so rigid that I always just copy paste this sort of thing into my code. so instead, I tried to make it pretty general (too general?).
tl;dr you provide a vertex and a fragment shader. #pragma statements in the vertex shader specify attributes and varyings as well as functions for computing line geometry (vertex position and width). It sets up the correct attributes, strides, etc and handles all the other details
Feels overwrought, but I'm pretty happy with how usable it actually seems in practice
seems very handy!!
Still making progress! Reworked the geometry and got the varyings unskewed by computing the projected offsets—so that you can do dashes!
makes me think of striped socks :smile:
Reminds me of Slimey
very cool work Ricky
thanks, @kevzettler! I kinda wanted to find out how hard it was to get a simple concept to documented, tested production quality. It's difficult.
thanks! ooh, that has significantly better corner behavior than mine. strictly speaking, mine sets up geometry to avoid skewed varyings, but it's otherwise agnostic toward how you might implement dashes.
in particular, mine provides no fragment shader. one of the main problems I was trying to solve was how attributes connect to vertices since that's usually very specific and ends up constraining everything end-to-end.
i'm making a webgpu compute micro-library with the same syntax/api as REGL. its 3.5 faster than webgl and gpus are only doubling every 4 years. together we could make the world a better place. lmk if u want to collab. the lib is anonymous and i accept contrib from anyone :)