simple coordinate question

I’ve had a bit of opengl experiances, but one thing I couldn’t clarify.
I want to do a 2d app, which displays a square.
This square goes from -1 to 1 on both horizontal and vertical axes.
My window is 640x480, and what I need to do is display this square so that the horizontal sides are RIGHT ON the upper and lower edges of my window.

After drawing my square at -1,-1 (top left) and 1,1 (top right), how much do I have to translate the matrix on Z axis so that I get what I wanted ?

just use an slightly modified identity projection, and it will work as expected :

  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  glScalef(480.0/640.0,1.0,1.0);
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();

EDIT: added scale to display correctly the square

[This message has been edited by ZbuffeR (edited 01-13-2004).]

use glOrtho and check out the params