I'm trying to move the camera along the XYZ axes.
To do this, I change the third parameter in the glulookat function and it behaves strangely.
Here is my entire code:
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(
0, 0, 1, //camera pos
0, 0, 0, //camera target
0.0, 1.0, 0.0
);
//draw grid
glutSwapBuffers();
If I write
gluLookAt(
0, 0, 1, //camera pos
0, 0, 0, //camera target
0.0, 1.0, 0.0
);
then everything works and draws a grid
But if I put
gluLookAt(
0, 0, 2, //camera pos
0, 0, 0, //camera target
0.0, 1.0, 0.0
);
then I don't see the grid.
Why is this happening and how to get rid of it?