View Full Version : confused about gluLookAt

03-20-2003, 06:43 PM

I am trying to use gluLookAt with perspective projection to "view" a 2d array of square polygons of different colors that I have drawn. The problem is I can only see a few of these. I believe that I need to adjust the first 3 args to gluLookAt but am not sure if I need to adjust the others as well. I currently have:

gluLookAt(0, 0, 350, 0, 0, 0, 0, 1, 0);

in my display function.

I read thru:

but am still confused about this.

Any suggestions are appreciated.


03-31-2003, 07:02 PM
Increasing viewangle will help,
heres some more complete camera code
that may help

float eyex, eyey, eyez; // eye
float near, far; // near and far clipping distance
float viewangle; // vertical view angle in degrees
float twist; // rotation angle about the view axis

int width, height; // input canvas width and height

// temp variables
float upx, upy, upz;
float aspect;
float rx, ry, rz;

aspect = (float)width/(float)height;
gluPerspective(viewangle, aspect, near, far);
rx = coix - eyex;
ry = coiy - eyey;
rz = coiz - eyez;
if (rx != 0.0 | | rz != 0.0) {
upx = 0.0; upy = 1.0; upz = 0.0;
else {
upx = 0.0; upy = 0.0; upz = -1.0;
gluLookAt(eyex, eyey, eyez, coix, coiy, coiz, upx, upy, upz);
glRotatef(twist, rx, ry, rz);