uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

What I posted is incredibly simple.

It takes very little effort.

I'm going to say its easier and more effective then what you posted even.

Why?

Becuase if you copy and paste that into your game, the type in the ExtractFrustum() in your draw function. Its ready to use.

Simply call what ever function you want. If you have a terrain in an array of some sort:

Code:

ExtractFrustum(); //
for( int r = 0; r < m_rows-1; r++ ){
for( int c = 0; c < m_cols-1; c++ ) {
bool drawTriangle = false;
if( (PointInFrustum( m_vertices[r][c].X, m_vertices[r][c].Y, m_vertices[r][c].Z ))
&& (dPointInFrustum(m_vertices[r][c].X, m_vertices[r][c].Y, m_vertices[r][c].Z) <= m_maxDist))
drawTriangle = true;
if( (PointInFrustum( m_vertices[r][c+1].X, m_vertices[r][c+1].Y, m_vertices[r][c+1].Z ))
&& (dPointInFrustum(m_vertices[r][c+1].X, m_vertices[r][c+1].Y, m_vertices[r][c+1].Z) <= m_maxDist))
drawTriangle = true;
if( (PointInFrustum( m_vertices[r+1][c].X, m_vertices[r+1][c].Y, m_vertices[r+1][c].Z ))
&& (dPointInFrustum(m_vertices[r+1][c].X, m_vertices[r+1][c].Y, m_vertices[r+1][c].Z) <= m_maxDist))
drawTriangle = true;
if( (PointInFrustum( m_vertices[r+1][c+1].X, m_vertices[r+1][c+1].Y, m_vertices[r+1][c+1].Z ))
&& (dPointInFrustum(m_vertices[r+1][c+1].X, m_vertices[r+1][c+1].Y, m_vertices[r+1][c+1].Z) <= m_maxDist))
drawTriangle = true;
if( drawTriangle ) {
glBegin();
glVertex3f( m_vertices[r][c].X, m_vertices[r][c].Y, m_vertices[r][c].Z);// Top
glVertex3f( m_vertices[r][c+1].X, m_vertices[r][c+1].Y, m_vertices[r][c+1].Z);// Bottom Right
glVertex3f( m_vertices[r+1][c].X, m_vertices[r+1][c].Y, m_vertices[r+1][c].Z);// Bottom Left
glVertex3f( m_vertices[r][c+1].X, m_vertices[r][c+1].Y, m_vertices[r][c+1].Z);// Top
glVertex3f( m_vertices[r+1][c].X, m_vertices[r+1][c].Y, m_vertices[r+1][c].Z);// Bottom Right
glVertex3f( m_vertices[r+1][c+1].X, m_vertices[r+1][c+1].Y, m_vertices[r+1][c+1].Z);// Bottom Left
glEnd();
}
}
}

Seems simple to me.