Advertisement

distance cut off

Started by April 25, 2003 12:47 PM
4 comments, last by soulspaceuk 21 years, 10 months ago
my problem is this: i''m making a 2d/3d space shooty kinda game using opengl.. basically, my problem is that opengl seems to stop drawing objects when they are more than about 1000 units away from the camera.. is there anyway to change this cut off? i''ve tried the opengl help file but I can''t seem to find it. thanks in advance jon
Are you using gluPerspective? Example:
gluPerspective(90.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);

In the above example "100.0f" would be the "far" distance. Change that value to whatever you want the maximum distance into the screen to be. At least, that's what I remember...

I believe it goes like this:
gluPerspective(FOV, aspectRatio, near, far);

--- Alex Broadwin
--- Domini Nocti Games

[edited by - PixolMaster on April 25, 2003 2:03:21 PM]
- [email=atronic@gamebox.net]Alex Broadwin[/email]- Adroit Creations- My Journal- The All-Knowing One
Advertisement
ah, ok, i wasn''t using that.. thanks - i''ll try it..
well, i''ve found
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, distance);

will do it- wouldn''t''ve stumbled accross that line in my code if it weren''t for the gluperspective suggestion tho.. so thanks :D
about glFrustum and glPerspective. what is the difference between the two? can they both be used in the same program? does glFrustum perform culling?
glFrustum does not perform culling. I believe gluPerspective makes the appropriate calculations and calls to glFrustum to set it up based on the numbers passed to it (near, far, FOV, etc). Frustum culling is where you see if something is outside of the frustum which is set up BY glFrustum. It would be nice if it did the culling for you, heh, but no...

(far)
___
\_/ <-- Frustum (set up by glFrustum/gluPerspective)

(near)
^
|
(viewer)

The area inside the frustum is your view area (what you can actually see). Frustum culling checks if objects are outside of that area and prevents them from being drawn to speed things up.

(please excuse the poor ascii example)

--- Alex Broadwin
--- Domini Nocti Games

[edited by - PixolMaster on April 25, 2003 6:53:24 PM]
- [email=atronic@gamebox.net]Alex Broadwin[/email]- Adroit Creations- My Journal- The All-Knowing One

This topic is closed to new replies.

Advertisement