Question

I understand that in OpenGL, we use the gluLookAt to place the camera relative to the world and thus define the image that would be drawn.

The "eye" specifies the position of the camera and the "center" specifies the point the camera is pointing towards. Once we know these two, we can draw a straight line from the eye to the center. The camera plane would be normal to this line.

Since we know this plane, the up vector specifies the top of the camera - basically which direction in this plane is upwards. Thus the up vector is always orthogonal to the vector joining the center and the eye.

My question is why do we need the full vector, when we just want to know the angle of rotation about the line joining "center" and "eye". Is the reason behind this a computational advantage that I am not aware of? And what if someone specifies a wrong up vector, which is not orthogonal to the direction of sight?

Was it helpful?

Solution

The up vector you pass in is used to indicate the up direction, but this is used with a cross product. I think the purpose of gluLookAt is to simplify the calculations needed by the user, so for example you would just pass (0,1,0) to indicate that the up direction you desire is along the positive Y-axis.

If you want better efficiency you could avoid gluLookAt entirely

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top