Traditional Culture Encyclopedia - Photography and portraiture - What is the vector representation of the up direction of the camera in OpenGL? What happens if we change the vector in the up direction? Is the direction of the up vector arbitrary?

What is the vector representation of the up direction of the camera in OpenGL? What happens if we change the vector in the up direction? Is the direction of the up vector arbitrary?

up includes inwards

The first group of eyex, eyey, eyez camera positions in world coordinates

The second group of centerx, centery, centerz camera lens pairs The accurate position of the object in world coordinates

The third group of upx, upy, upz is the upward direction of the camera in world coordinates

There is this explanation on the Internet, I think it suits me , see if it suits you.

The first set of eyes is equivalent to the specific coordinates of your head in a three-dimensional coordinate.

The second group is the coordinates of the object your eyes want to see.

The third group is the direction of your head.

If you set upx=0;upz=0;upy=1, it means that your head is in the same direction as a normal person. If upy=-1, it means that you are upside down.

If upx=1;upz=0;upy=0; then it is equivalent to looking at the right side. If upy=-1, it is equivalent to looking at the left side.

If upx=0;upz=1;upy=0; it means that we are looking at the screen facing our direction (can’t remember whether the positive direction of the z-axis is facing in or out, if it is wrong Equivalent to this z is the opposite of what I said), if upz=-1, it means that we are looking in the direction of the screen.

You will understand the function glLookAt() after you try it more.