I need to draw a line (light-source/light-target) with Metal on macOS within a 60 FPS animation while the two endpoints coordinates of the line change on each frame.
Actually I can properly draw a static line with Metal using a MTLBuffer
containing just two fixed endpoints, but any transformation I apply on the line matrix affects both the endpoints, not each endpoint independently.
So how can a vary each of the two endpoints coordinates at each render pass? Is a way to modify the MTLBuffer
at each frame? Should I pass the two coordinates to the shader through setVertexBytes:
then use a different pipeline to draw this line?