Need help setting the camera

How to set the values of gluLookAt() in order to see the entire grid from ABOVE?

This is a part of my code:

void Draw_Grid()
{                                                            

    for(float i = 0; i <= 1000; i += 50)
    {
        glBegin(GL_LINES);
            glColor3ub(150, 190, 150);                        
            glVertex3f(0, -4, i);                    
            glVertex3f(1000, -4, i);
            glVertex3f(i, -4,1000);                            
            glVertex3f(i, -4, 0);
        glEnd();
    }
}

void screen_reshape(int width, int height)
{


    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
   
    float ar;
    
    ar = ((float) width)/height;
    if(ar > 1.0)
        glOrtho(-10,1000.0*ar,0,1000.0,-1000.0,1000.0);
    else
        glOrtho(-10,1000.0,0.0,1000.0/ar,-1000.0,1000.0);
        .
        .
        .
        gluLookAt(?, ?, ?,?, ?, 0, 1,0);
} 

<mair>
Try this:
gluLookAt(500, 500, -4+dist, 500, 500, -4, 1, 0, 0)

Notice the camera’s up-vector is (1,0,0), so the bottom-left corner is the origin and right direction is +Z and up direction is +X.

Adjust “dist” value whatever you want. (for example, 500 ?)

thanks but it’s not working!!
It displays just one vertical line!

Any other suggestions?

Oops. :stuck_out_tongue:

Sorry I confused about y and z axis. It should be:
gluLookAt(500, -4+dist, 500, 500, -4, 500, 1, 0, 0)

It gives you the camera at (500, -4+dist, 500) and looking at (500, -4, 500). Up-vector of camera is +X axis.

==song==

THANKS!!!