I know how to use glOrtho but Im having trouble with glFrustum. Specifically with the last two parametrs in it
s method. I thought if i put a negative number for near and a positive number for far then my camera would render everything in between. So if I place an object on the z coordinate of 0 and near on z = —3 and far on z = 3 then my object would be displayed. Unfortunately this hasnt worled so what exactly am I not doing right? I
ve actually got it to work by placing my object on z = —4, near = 4 and far = 10, but this makes no sense to me. Help?
With a perspective matrix, looking inwards is actually looking down the -Z axis. While the last two parameters of glFrustum must be positive, they are actually the negative Z near and far values. Yes, it’s quite confusing at first
If you’re interested the reason is that glFrustum() specifies a projection transform. If we are using the camera analogy, the projection transform is the lens of the camera. So being a projection transform, it doesn’t have any impact on the direction the camera is facing.