Generalize line rendering method.
Refactor draw_triangle function and vertex struct.