Hi,
I’m writing a window manager that uses OpenGL as the rasteriser. Bizarrly, I have a problem with straight lines.
I set the screen up so that the x,y dimensions coorespond to the pixel width / height of the video mode.
int GLRasteriser::Set2DLinearMode()
{
float matrix[16];int x,y,bpp;
GB_GetScreenDimensions(&x,&y,&bpp);
glDisable(GL_NORMALIZE);
glDisable(GL_LINE_SMOOTH);glViewport(0,0,x,y);
glMatrixMode(GL_PROJECTION); // set up projection transform
glLoadIdentity();gluOrtho2D(0,(double)x,(double)y,0); // Top left = 0,0 screen origin
glMatrixMode(GL_MODELVIEW); // now change to modelview
glLoadIdentity();return TRUE;
}
When I try an draw a line (glBegin(GL_LINES))that is approx. 75% of the screen away from the origin it is draw at 1 pixel less than the specified coordinate. What makes it really strange is that calls to glBegin(GL_QUADS), for filling the windows, and glDrawPixels get the correct coordinate.
Any ideas?
Leo