Function prototype
Gluperspective (gldouble fovy, gldouble aspect, gldouble znear, gldouble zfar)
First, set gluperspective to see what its parameters mean.
Fovy, which is the most difficult to understand. My understanding is that the angle of open eyes, that is, the size of the angle of view. If it is set to 0, you close your eyes, so you cannot see anything, if it is 180, you can think that your vision is very broad,
Aspect. This is the aspect ratio of the actual window, that is, x/y.
Znear. What about this? It indicates your neighborhood,
Zfar indicates the cutting surface in the distance,
If you do not understand it, continue reading,
We know that something in the distance looks smaller, and something in the near area looks larger, which is the principle of perspective.
As shown in
Assuming that the two lines represent highways, in theory, their two sides are parallel,
But in reality, they always have to be at one point in the distance (infinitely far,
The actual line segment AB is equal to the length of CD, but the perspective angle is used in this example, so the above effect will be displayed. Is it very close to the reality?
Combining the two functions
Znear: the distance between the eyes and the distance between the eyes. If it is 10 meters long, do not set it to a negative value. OpenGL is silly. I don't know how to calculate it,
Zfar indicates the cutting surface in the distance. It is assumed that it is 1000 meters away,
The meaning of these two parameters,
What does the "Eye Open Angle" mean,
First, let's assume that we are currently at a position 50 units away from an object,
When the eye open angle is set to 45, check the screen:
We can see that there is a ball in the distance. It's fun,
Now let's open our eyes and set the "Eye Open Angle" to 178.
(180 degrees indicates the angular angle. At that time, we could not see anything. Our eyes were too big and our eyes were too big)
We only see one vertex ,,,,,,,,,,,,,,,,,,,,,,,,,,,
Because the range we see is too large, the size of the ball has not changed, but it is too small in our "Horizon,
On the contrary, we closed our eyes a little and changed them to 1 degree to see what would happen?
when we are 3000 away from the object and" Eye Open Angle "is 1, we seem to have entered the ball. Is it similar to the focal length of the camera?
when we set "Perspective angle" to 0, we close our eyes and the world is quiet.
we can't see anything,