View Full Version : Question about camera
Mr. Bitmap
07-26-2002, 02:29 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif
Miguel_dup1
07-26-2002, 03:41 PM
Originally posted by Mr. Bitmap:
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 http://www.opengl.org/discussion_boards/ubb/smile.gif
Try changing the 5 value to 1...
It may help.
glLoadIdentity();
gluLookAt(0, 10, 0, 0, 1, 0, 0, 1, 0);
Citizen Thomas
07-26-2002, 04:33 PM
"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
Mr. Bitmap
07-27-2002, 12:03 AM
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.
satan
07-27-2002, 01:53 AM
Originally posted by Bob:
gluLookAt(0, 10, 0, 0, 0, 0, 0, 1, 0);
Your up vector is parallel to the view vector, which is really bad.
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.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.