camera work (serious)

i am working on a code to understand working of a camera in way that a first person shooter without weapon walks
i have programmed and at few point i got some headache points in my code
i am giving few parts of code if you need more then post me

1st:


void CameraMan()
{
///gluLookAt(x,y,z,Cx,Cy,Cz,0.0f,1.0f,0.0f);Cx <->x , Cy <-> y Cz <->z
//for circle there must radius let it 0.5f
Cx = sin(alpha*M_PI/180);
Cz = cos(beta*M_PI/180);
Cy = sin(alpha*M_PI/180)*sin(beta*M_PI/180);
gluLookAt(x,y,z,Cx+x,y + 0.1f,Cz+z,0,1,0);

}

2nd:yes depth double buffer turnned on


  glMatrixMode(GL_PROJECTION);
glLoadIdentity();

CameraMan();
glPushMatrix();
glRotatef(90.0f,1.0f,0.0f,0.0f);
glColor3f(0.0f,1.0f,0.0f);

glRectf(2.0f,2.0f,-2.0f,-2.0f);

glPopMatrix();



   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();

3rd: i found perspective function related to frustum but fovy zNear and zFar are related to each other or not but what there value should be (i am weak in represntin 3d(specially position and angle))


void WinSize(int w,int h)
{
GLfloat As = (GLfloat)w/(GLfloat)h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(180.0f,As,-100.0f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0,0,w,h);
}

4th: angle function controll


void Special(int k,int x,int y)
{
switch(k)
{
case GLUT_KEY_UP:
alpha+=0.1;
break;

case GLUT_KEY_DOWN:
alpha-=0.1;
break;

case GLUT_KEY_LEFT:
beta+=0.1;
break;

case GLUT_KEY_RIGHT:
beta-=0.1;
break;

}
}


and there keyboard function also
w-> incremental of z
a-> incremental of x
s-> -ve of w
d-> -ve of s
light and fog also for what is front and how much far

please help me regard tis

thanks in advanced
thanks to jan
Vivek

try gluPerspective(45.0f,As,0.1f,1000.0f);

i tried but it not work much
at some point i got polygon cutted when go farther or more above nearer
i just want to rotate on axis of our head please help me
if do wrong in these sin cos function

As I said before, I think I read somewhere that zNear value should be >=1… So:

gluPerspective(45.0f,As,1.0f,1000.0f);

And you should also try to keep the zFar value to minimum possible…

actually znear could be anything as long as it’s positive, it’s the ratio between znear and zfar you have to watch out for, 1:10000 is ok depending a little on what your doing, 1:1000 is recommended, though it won’t really matter if you can’t get something on the screen.