orhogonal stuff

Hi,

I want to display a 2d picture (640x480) as polygons. I split up the picture to 256x256 textures, I map them onto 6 polygons, I set the coordinates to screen coordinates.
I set up my matrices with the following code:

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0,640,480,0,-25,25);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glViewport((int) 640 - 1, (int) 480 - 1, -25, 25);
glTranslatef(320.0f,240.0f,0.0f);

(I have a similar routine on glide and that is working well.)

And I got small thin lines (horizontal, vertical) between my polygons. The coordinates are correct(according to the glide routine). I experienced it on nvidia tnt, tnt2, geforce 1-2 and matrox g400. So I think it is me who is doing something wrong.

What do I do wrong?

Please help!

mandroka

[This message has been edited by mandroka (edited 08-14-2000).]

glOrtho(0,640,480,0,-25,25); // This builds a top left origin. For 2D it’s not necessary to specify this large z-Area use -1, 1 for defaults.

glViewport((int) 640 - 1, (int) 480 - 1, -25, 25); // I would have expected glViewport(0, 0, 640, 480) here. You’re actually seeing your polygons?
glTranslatef(320.0f,240.0f,0.0f); // This sets the 2D origin to the center of the screen, but why? You’re in 2D and could issue screen coordinates for your polygons.

>>And I got small thin lines (horizontal, vertical) between my polygons.

You have to issue exactly the same coordinates for the shared vertices. You didn’t give the drawing code. If you change the modelview matrix between polygons you could get rounding errors.

[This message has been edited by Relic (edited 08-15-2000).]