glOrtho() in fixed function pipeline - Unable to see change in z-axis
This projection is a 2d projection, with the Z axis pointing into your screen. When both vertices with the same X&amp;Y are projected to screen space they will occupy the same screen coordinate so your line will either be 1 pixel or invisible.

If you are expecting a difference in screen position from those 2 coordinates then you need a perspective projection.