Hello all,
I created a window which is 600x400 pixels. I checked the size with another tool, the size is correct.
I use OpenGL and minGW on Windows XP
Now I want to paint a red frame around this window with this code
glViewport(0, 0, 600, 400); // x, y, w, h
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 599, // left/right
0, 399, // bottom/top
1, -1); // near/far
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINE_LOOP);
glVertex2d(0, 0);
glVertex2d(599, 0);
glVertex2d(599, 399);
glVertex2d(0, 399);
glEnd();
Unfortunately the frame has a y-offset by 1 pixel, that mean the upper line is outside the window and the bottom line is 1 pixel above the lower window bottom.
Where does this offset come from?
Did I a mistake and what must I that the coordinates of the win32-window matches the OpenGL-coordinates (of course the top of OpenGL is the bottom of the Win32-window)
Thanks again for your help