URGENT! NEW How can I get a normal axis?

Hi!
I am trying to draw some points using the glut.h. Well, I am limited to draw within the xy axis from 0.0 to 1.0. I know there is a way to zoom or scale but I didn’t learn it yet. I will be opening a window (600x600). I would like to type something like glVertex2i(200,50)with an axis from -200 to +200 or the xy axis (0,0) starting from the top left of the window. Please help me as I know it is not hard but as I said, I didn’t learn it yet. Thank you. Lio

Is it for rendering a little set of objects in the 2D screen, or do you want all your graphics to be 2D ?

If you want all your objects to be 2D
When you set up your projection matrix, you surely have something like :

glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
...
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
...

Replace it with :

glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, window_width, 0, windiw_height, near_value, far_value);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
...

where near_value and far_value are the values of your near and far planes, respectively. I recommend near_value=-1 and far_value=+1 for 2D drawing, but choose whatever you want.

If you want only a few objects to be 2D
When you render those objects, call this :

{
  GLint viewport[4];
  GLint matrix_mode;

  glGetIntegerv(GL_VIEWPORT, viewport);
  glGetIntegerv(GL_MATRIX_MODE, &matrix_mode);

  glMatrixMode(GL_PROJECTION);
  glPushMatrix();
  glLoadIdentity();
  glOrtho(viewport[0], viewport[2], viewport[1], viewport[3], near_value, far_value);

  glMatrixMode(GL_MODELVIEW);
  glPushMatrix();
  glLoadIdentity();

  /* render your set of 2D objects here */

  glPopMatrix();
  glMatrixMode(GL_PROJECTION);
  glPopMatrix();
  glMatrixMode(matrix_mode);
}

Where near_value and far_value are the same than the ones you may have used in the previous method (ALL objects rendered 2D)

That’s it. I hope that’s what you looked for.
You can also find an answer at OpenGL coding FAQs here .