Advertisement Jump to content
Sign in to follow this  

Help with view frustum

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Maybe this question was asked a lot :o How can I get if an object is inside the view frustum? For example: I have a box, and while I move the camera, I want to know if the box is inside the frustum or not. Thanks.

Share this post

Link to post
Share on other sites
I think your the 4th this week (my self included) :)

Basically your frustum is made up of 6 planes that all face inward, so we simply find the distance of a point (pt) to each plane. If any are negative then the point must be outside of the frustum.

int p;
for( p = 0; p < 6; p++ )
if( viewFrustum

.a * pt.x + viewFrustum

.b * pt.y + viewFrustum

.c * pt.z + viewFrustum

.d <= 0 )
return NEGATIVE;
return POSITIVE;

If you don’t have those 6 planes then you need to construct them each frame.
You can find more GL related info here

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!