PDA

View Full Version : Trouble with gluLookAt



David Doria
08-31-2008, 07:01 AM
I am trying to do a simple Right view, Left view, Top view type of thing.

From my understanding, gluLookAt takes
(x,y,z, vx, vy, vz, ux, uy, uz)

where
(x,y,z) is the position of the "camera"
(vx,vy,vz) is a point on the view vector (in my case I want it to look at the origin)
(ux,uy,uz) is the "up" vector of the camera (which only determines the "roll" angle)



else if(key == 'r')
{
glLoadIdentity();
gluLookAt(10, 0, 0,
0, 0, 0,
0, 1, 0);
}
else if(key == 'l')
{
glLoadIdentity();
gluLookAt(-10, 0, 0,
0, 0, 0,
0, 1, 0);
}
else if(key =='t')
{
glLoadIdentity();
gluLookAt(0, 10, 0,
0, 0, 0,
0, 0, 1);
}


I drew a cube and then tried this out. The problem is that no matter what I set the (x,y,z) to, it is always VERY close to the cube. I thought if i set it to (10, 0, 0) the cube would look much bigger than if I set it to (100, 0, 0). They look exactly the same size.

What have I missed?

Thanks!

Dave

gui24a
08-31-2008, 04:37 PM
Probably you are using orthogonal projection (gluOrthoxx).

Change to perspective projection using gluPerspective instead of gluOrtho

Simon Mihevc
09-01-2008, 12:23 AM
If you put the cube close to near or far plane it will look the same because you're using parallel projection. If you want to make it bigger scale it.