nik_bg

10-13-2004, 05:46 AM

Here is a simple code:

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

glOrtho(0, 800, 0, 480, -1, 1);

glRasterPos(0,0,0);

glBegin(GL_LINES);

glVertex2i(10, 10);

glVertex2i(100, 10);

glEnd();

These coordinates should be equivalent to screen ones and the line should be a simple horizontal from x=10 to x=100 screen coord. Unfortunately from time to time the line is drawn to x=99 or x=101, depending on the y position (!!!). Any idea, please ??

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();

glOrtho(0, 800, 0, 480, -1, 1);

glRasterPos(0,0,0);

glBegin(GL_LINES);

glVertex2i(10, 10);

glVertex2i(100, 10);

glEnd();

These coordinates should be equivalent to screen ones and the line should be a simple horizontal from x=10 to x=100 screen coord. Unfortunately from time to time the line is drawn to x=99 or x=101, depending on the y position (!!!). Any idea, please ??