Computing View Volume Parameters at Runtime

Started by
0 comments, last by rajesh_nest 13 years, 7 months ago
I have to compute the parameters of the view volume (Perspective - gluPerspective) at run time.

My approach is as follows

1. Find bounds of the mesh (xmin,xmax,ymin,ymax,zmin,zmax).
2. set znear = zmin + threshold, zfar = zmax + threshold. (threshold some constant value hard coded).
3. Compute distance = ZNear - ZPositionoftheCamera.
4. Compute fov = 2*tan-1(height/2*distance);

Are the above steps enough for computing view volume at run time?

[Edited by - rajesh_nest on September 2, 2010 11:18:50 AM]
Advertisement
Hope My query did not confuse? Let me make it clear.

I am developing a meshviewer software. I was manually correcting parameters of Perspective viewing volume (fov,aspect ration,ZNear and Zfar), for the viewing the mesh.

Now I want the software to automatically compute parameters when the mesh is loaded. The steps listed above is suppose to do same.

But I am not sure, whether the steps are correct.

This topic is closed to new replies.

Advertisement