Archived

This topic is now archived and is closed to further replies.

laeuchli

gluPerspective

Recommended Posts

What should I set parameters of this function to? I keep getting zfighting, and things disapper to quickly when I get close to them. I''ve tried changing znear, but it doesn''t help much. What values do you all use???

Share this post


Link to post
Share on other sites
Here''s a part of my post in the Draw Distance thread, hope this helps.

gluPerspective( fov, ratio, near, far );

fov - this variable is the field of view (you probably know this) to either side of center, so it''s half of the total field of view. So if you wanted the fov to be 90 deg, then you would set this to 45.

ratio - the aspect ratio of the screen, this is just width/height, I would suggest using your resolution in that ratio, but 4/3 (1.3333f) should work for most standard resolutions.

near - the near clipping. This is how far from the camera an object must be to still be drawn on the screen. Set this to a very small value, I had it at 0.1f.

far - far clipping. This is how deep the depth buffer will be. If you''re going to use a skybox and you want each polygon to be 50 units away from the camera, you will need to set this at least to the square root of triple 50 squared (I''m assuming you know the pythagorean theorem and probably trigonometry too) to prevent the corners from being clipped. So, for a distance of 50, you''ll want to set this to at least 87.

Share this post


Link to post
Share on other sites
Ummm if say your skybox is 50 units away from the camera at the center of each polygon, and your far distance is closer than 86.something, then you will get the skybox clipped, so yes, it does matter how far away things are clipped for your skybox.

Share this post


Link to post
Share on other sites