Frustum Culling

Hi, I’m just implementing frustrum culling in one of my programs and I believe its working correctly I was just wondering if anyone had any methods that could test this correctly.
Thanks in advance

You can modify modelview matrix you send to card so you see scene from diferent point with culling using the original position and orientation. The GLIntercept tool can do this for you if you use standard modelview matrix stack.

I have no idea about the function glFrustum(). However giving the argument of the function gluPerspective(), we can find the width and height of the near and far planes.
If we use from the following function:
gluPerspective(fov, ratio, nearDist, farDist);
Then the height and width of the near plane are:
Hnear = 2 * tan(fov / 2) * nearDist
Wnear = Hnear * ratio
And the width and height of the far plane are:
Hfar = 2 * tan(fov / 2) * farDist
Wfar = Hfar * ratio

These values-Hnear, Hfar, Wnear, Wfar, nearDist and farDist - make a frustum and you can test if your objects are within the frustum.
-Ehsan-

I guess this is not what he expected :slight_smile: He certainly made what you told. He just wanted to test if he has done it correctly.

But to my opinion this is out of GL…

Yes I have the frustrum created and then test to see if the objects are in that space, its just then testing to ensure culling is taking place…Thanks anyway

I’ve found that giving my frustum a slight “pinch” in the FOV relative to the actual OpenGL view pyramid helps me to visualize things a bit. This way I can see objects being culled before they actually leave the visible frustum. You know, just as a sanity check.