glFrustum scaling effect seemingly too large
Hi, I'm fairly new to OpenGL, so perhaps I'm completely wrong about this, but it seems to me that the rate at which shapes shrink as they are moved away from the camera (along the z axis) is too much (for me, anyway).
What I am trying to do is to get a rotating cube that lies completely within the field of view (or projection, I guess) and that occupies a relatively large portion of the screen. I achieved the desired result when using glOrtho (as the cube doesn't shrink when it moves down the z axis); but whenever I try it with glFrustum, the cube is always tiny. The reason for this, is that for the cube to be completely within the field of view it needed to be moved back so far; and when it was moved back so far, it was always really small, due to the large reduction in size by being moved on the z axis.
As an example of the reduction amount (in word form), when I place a square with screen width and height dicrectly in front of the camera (z=-1), it fills the screen (as expected). However, when I move said square back one unit along the z axis (z=-2) the square shrinks to 1/2 or, maybe, 2/3 of its original size. Another unit along the z axis decreases its size significantly again, etc.
So, my question is: is it possible to reduce the rate at which objecs shrink/grow when moved along the z axis? Or is there some other way to enlarge objects removed along the z axis, and still keep them within the field of view?
My OpenGL version is 4.2, by the way (if it matters )
"The rate of shrinking", as you call it, can be changed by varying near/far clip-plane distance.
Originally Posted by Zaakari
But, before going any further, please read something about perspective definition, and how glFrustum() and gluPerspective() work. You need to understand some basic concepts...
Perspective scaling is always a strict reciprocal relationship: if you double the distance of the object from the viewpoint, the scale factor will halve.
Assuming that you want the correct aspect ratio, the only other parameter involved is the field-of-view angle. If you reduce the angle so that the object needs to be placed at e.g. z=-3 in order to fill the screen, then a 1-unit change to z=-4 will only reduce the scale by 3/4 rather than 1/2.
Ah, I tried changing the far clip-plane, but didn't think to change the near; that worked. Thank you.
Originally Posted by Aleksandar
And thank you GClements, that helps my understanding of it.