Archived

This topic is now archived and is closed to further replies.

Anybody know what this does?

This topic is 5801 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

gluLookAt( 0.0, 1.0, 1.0, // camera''s position 0.0, 1.0, 0.0, // camera''s line of sight 0.0, 1.0, 0.0); // camera''s up direction This code segment is from a program that has a stationary camera and snow just falls down in front of it. I just dont understand it. Shouldnt the center(line of sight) parameters be pointing down the negative z axis? What''s the point of hae the center and up parameters the same? And because the camera is stationary wouldnt you want the camera at the origin. I think it should be gluLookAt(0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0). What am I missing?

Share this post


Link to post
Share on other sites
You usually move the camera away from the origin because that's were the 'objects' are created if you don't translate them.

Thus, without adding any extra translations, you are looking at the interesting location.

The second line parameters aren't the camera's line of sight, but the camera's centerpoint. That is what point are you looking at.

Here, you are in (0, 1, 1) looking at (0, 1, 0), that is a view vector of (0, 0, -1 ), or -Z.

And your up vector is ( 0, 1, 0 ), or +Y.

-Z != +Y, Q.E.D.

Edited by - Fruny on January 29, 2002 2:57:40 AM

Share this post


Link to post
Share on other sites
How do you go from the point your looking at(0,1,0) to the view vector(0,0,-1)?

Wait...nevermind. I got it. You have to take the resultant of where your standing to the vector your looking at.

Edited by - executor_2k2 on January 29, 2002 3:02:57 AM

Share this post


Link to post
Share on other sites
gluLookAt(
0.0, 1.0, 1.0, // camera''s position
0.0, 1.0, 0.0, // camera''s line of sight
0.0, 1.0, 0.0); // camera''s up direction

your understanding is wrong instaed of // camera''s line of sight this is position where the camera is looking to (thus u can be standing somwhere + also looking there as well, picture it)

>>I think it should be gluLookAt(0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0).

this is correct but ''What''s the point of hae the center and up parameters the same?'' can easy happen eg lookat(0,1,2,0,1,0,0,1,0)
which is practically the same as gluLookAt(0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0)

Share this post


Link to post
Share on other sites