Question about camera

Ok, I searched the forum before posting but couldn’t find what I was looking for.

How do I set up my camera to be at 0, 10, 0 and look at 0, 0, 0? I Tried everything but I just can’t do it

Here’s what I have so far:

glLoadIdentity();
gluLookAt(0, 10, 0, 0, 0, 0, 0, 1, 0);

// Here I call load identity before drawing each object and translate to its x, y, z coordinates

But it always turns out I’m at 0, 0, 0 and facing forward.

If that made any sense, try to help me please

Originally posted by Mr. Bitmap:
[b]Ok, I searched the forum before posting but couldn’t find what I was looking for.

How do I set up my camera to be at 0, 10, 0 and look at 0, 0, 0? I Tried everything but I just can’t do it

Here’s what I have so far:

glLoadIdentity();
gluLookAt(0, 10, 0, 0, 0, 0, 0, 1, 0);

// Here I call load identity before drawing each object and translate to its x, y, z coordinates

But it always turns out I’m at 0, 0, 0 and facing forward.

If that made any sense, try to help me please [/b]

Try changing the 5 value to 1…
It may help.

glLoadIdentity();
gluLookAt(0, 10, 0, 0, 1, 0, 0, 1, 0);

"glLoadIdentity();
gluLookAt(0, 10, 0, 0, 0, 0, 0, 1, 0);

// Here I call load identity before drawing each object and translate to its x, y, z coordinates"

wouldn’t calling load identity before drawing each object wipe out the effect of the gluLookAt() call? i think you want something like this:

glLoadIdentity();
gluLookAt(whatever);
glPushMatrix();
//draw object one
glPopMatrix();
glPushMatrix();
//draw object two
glPopMatrix();
//etc etc

I’ll try it. Thanks.

gluLookAt(0, 10, 0, 0, 0, 0, 0, 1, 0);

Your up vector is parallel to the view vector, which is really bad.

Originally posted by Bob:
[b] [quote]
gluLookAt(0, 10, 0, 0, 0, 0, 0, 1, 0);

Your up vector is parallel to the view vector, which is really bad.[/b][/QUOTE]

Because of this you can try an up vector of 0,0,-1, which should give you a camera looking down the y-axis and the up vector pointing into the screen.