Code:#include <math.h>#include <GL/glut.h>#pragma comment(lib, opengl32)#include <gl/gl.h>#include <gl/glu.h>//Initialize OpenGL void init(void) {    glClearColor(0, 0, 0, 0);    glViewport(0, 0, 500, 500);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    glOrtho(0, 500, 0, 500, 1, -1);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity();} void drawLines(void) {    glClear(GL_COLOR_BUFFER_BIT);      glColor3f(1.0,1.0,1.0);     glBegin(GL_LINES);    glVertex3d(0.5,         0.999,  0.0f);    glVertex3d(499.501,     0.999,  0.0f);    glEnd();    glFlush();} int _tmain(int argc, _TCHAR* argv[]){    glutInit(&argc, argv);      glutInitWindowPosition(10,10);     glutInitWindowSize(500,500);     glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);     glutCreateWindow(Example);     init();     glutDisplayFunc(drawLines);     glutMainLoop();    return 0;}Problem description:Above code will put the entire bottom row pixels of the window client area to white.If I swap the command order, from glVertex3d(0.5, 0.999, 0.0f);glVertex3d(499.501, 0.999, 0.0f); to glVertex3d(499.501, 0.999, 0.0f);glVertex3d(0.5, 0.999, 0.0f);, then only the left bottom pixel will not draw.My understandings:The two vertices will be finally transformed to 2D pixel center coordinate which are (0.0, 0.499) and (499.001, 0.499).The line drawing algorithm only accept pixel center integer points as input.So the two vertices will using int(x + 0.5) and will be (0, 0) and (499 , 0). This conforms to first result but contradict to the result when input order changed. Why?
Why different result when change input order in GL_LINES?
opengl;line drawing;legacy opengl