Anybody know what this does?
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?
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
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
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
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
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)
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)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement