Drawing lines by simulating the immediate mode