# glOrtho() in fixed function pipeline - Unable to see change in z-axis

void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINES);
glVertex3d(0.75, 0.25, 0.0);
glVertex3d(0.75, 0.25, -0.75);
glEnd();
glFlush();
}

void init(void) {
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}


I should be able to see line from (0.75, 0.25, 0.0) to (0.75, 0.25, -0.75), but I can't see anything on the screen.

However, I'm able to see the line using snippet below

glVertex3d(0.35, 0.25, 0.0);
glVertex3d(0.75, 0.25, -0.75);


Can anyone explain this behavior?

• This projection is a 2d projection, with the Z axis pointing into your screen. When both vertices with the same X&Y are projected to screen space they will occupy the same screen coordinate so your line will either be 1 pixel or invisible. Jul 5 '17 at 3:20
• @PaulHK You should write that as an answer. Please avoid writing answers as comments, because they might get lost. Comments are for temporary messages only. Jul 5 '17 at 7:52