Is there any clue why this code does not draw the two lines?
void renderScene(void) {
glMatrixMode(GL_PROJECTION);
glOrtho(0.0, 1000, 0.0, 1000, 0, 0);
glClearColor(0,0,0.5,0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1,1,1);
glBegin(GL_LINES);
glVertex2i(10, 70);
glVertex2i(900, 70);
glVertex2i(500, 700);
glVertex2i(500, 10);
glEnd();
glutSwapBuffers();
glFlush();
}
glOrthodoes not simply set a matrix, but multiplies the current matrix by the new orthographic projection matrix. Since OpenGL is a state engine, the matrix is kept across frames, so the matrix is changed gradually. You must load the identity matrix before you can define the projection matrix withglLoadIdentity: