It works almost fine but there is still a problem. I follow these steps:
if a portal is inside or intersects with the currently used frustum
then
look for its leftmost point
look for its rightmost point
look for its topmost point
look for its bottommost point
left <- max( abscissa of the leftmost point , current frustum left )
bottom <- max( ordinate of the bottommost point , current frustum bottom )
right <- min( abscissa of the rightmost point , current frustum right )
top <- min( ordinate of the topmost point , current frustum top )
sub-frustum <- copyOf( current frustum )
sub-frustum.left = left
sub-frustum.right = right
sub-frustum.top = top
sub-frustum.bottom = bottom
As my explanation might be not clear enough, please look at this article, it deals with some algorithms used in Fallout 3:
http://geck.bethsoft.com/index.php/Occlusion_Culling
My sub-frustum seems to be too small whereas I only get normalized device coordinates of the portal and I convert them into frustum coordinates. When I create a sub-frustum from the current frustum, should I change anything else than left, right, top and bottom?
Normalized device coordinates are defined in the explanation below:
[quote]Object Coordinates are transformed by the ModelView matrix to produce Eye Coordinates.
Eye Coordinates are transformed by the Projection matrix to produce Clip Coordinates.
Clip Coordinate X, Y, and Z are divided by Clip Coordinate W to produce Normalized Device Coordinates.
Normalized Device Coordinates are scaled and translated by the viewport parameters to produce Window Coordinates.
[/quote]