Posted 21 March 2012 - 11:36 PM
Posted 21 March 2012 - 11:48 PM
However, if you want to use glFrustum, try
float halfWidth = tan(0.5 * fovHorizontal); float halfHeight = tan(0.5 * fovVertical); glFrustum(-halfWidth, halfWidth, -halfHeight, halfHeight, zNear, zFar);
That's what gluPerspective does internally (except it calculates fovHorizontal as aspect * fovVertical), so that should do it.
Posted 22 March 2012 - 12:13 AM
so if I have a FOV of 35, how do I get the fovH and fovV? Is FOV normally horizontal or vertical? fovH = fovV * width / height; but how to get fovV?
What about the near/far? how do we know what to use? Is it the bbox max size of the model for zFar? what about zNear?
Posted 22 March 2012 - 12:32 AM
Near clip is how close you want the camera to be able get to a polygon before clipping it. And far clip is how far away you want to be able to see things before they clip out. You have to decide these too. If the near clip is too small it will cause Z-fighting and suchlike. For example, for rendering a human-scale world you might use a near clip of 10 centimeters and a far clip of 10 kilometers.
Posted 22 March 2012 - 12:48 AM
about the near/far clipping, do the units are those of the model or glFrustum uses meteric? Way, if a house is 50' x 50' is it safe to set zNear to 1 and zFar to 51? Because on my end, one of the corner of the house is at 0,0,0 and I set the zFar to 50 and when I rotate it with glRotatef() it gets clipped when going away from the eye!?
Posted 22 March 2012 - 01:02 AM
I trired fovV = 2*atan(fovH*(Width/Height)); but now everything is almost flat ha ha!
Posted 22 March 2012 - 03:42 AM
Posted 22 March 2012 - 01:29 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users