Draw distance

Started by
18 comments, last by Paddeh 22 years, 5 months ago
:O
that sounds way ahead of me
I realise im supposed to use this command, but im not sure exactly HOW to use it... what kinda values should i be using for a world thats basicly the size of a 50x50 cube? (skybox)
and should it go in my draw function or int function or what?
thanks again
Advertisement
It should go in your initialization function. Here''s how it works:

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.
thanks again, however, this code just simply refuses to work atall. It compiles and all, it just has no visible effects. thanks anyway
Then forget about gluPerspective function and use glFrustum instead. The last parameter in glFrustum should be rather big in order to render your skybox properly. By the way, I had the same problem long time ago and it dissapeared when I increased the last glFrustum parameter. This *MUST* work
clearly i am doing something horribly wrong, as none of these functions will make the slightest bit of difference
anyway, thanks all for your help, I''ll leave it alone for now and hope that it sorts itself out ;O
ello,

"basicly i''ve got a skybox with a world in the middle of it, if i move to one corner of my skybox the other corner gets cut off when i look towards it. "

hmm? If camera moves, you should move the skybox as well. So camera is ALWAYS in the center of it.



With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
With best regards, Mirek Czerwiñski
umm
then my camera system would be redundent, the idea is to have a camera that actually moves. and doesnt stay stuck in the middle of a box
paddeh u misunderstand a skybox. u can never get closer to a skybox if the camera could move inside a skybox then the whole skybox effect wouldnt work cause the textures are meant to be seen when the camera is in the exact center of the box, if the camera aint then the textures will apppear to be distorted
now im confused >:| I really didnt think it mattered. anyway, I guess i''ll wait a while before I attempt this kinda thing again
guess its for more experienced programmers
thanks for the help all
have a read of this, perhaps itll help
http://www.gamasutra.com/features/visual_arts/19981023/skybox_01.htm

This topic is closed to new replies.

Advertisement