In need: frustum culling code...

do you guys have a frustum culling code other than that shown by markmorley/gametutorials? is there another way than what is taught by gametutorials?

Where’s the problem? It works.
If you don’t like it you can create your own, using math, but that is likely to be worse.

I should’nt think there will be many variations on frustum culling.

Break the scene into blocks (cube requires only 8 points).
Check if any part of the scene is in the view frustum.

If so draw it.
If not, dont.

I used the version on Nehe.

If you find a better way, let me know.

i have tried the frustum culling code in true enough, it works, except that i notice that it doesn’t remove polygons properly on the right plane.

i’ll give you guys a screenshot of what i mean in a while… .

Subdividing the scene into cubes is equivalent to space partitioning algorithms like Octree.

Frustum Culling is the clipping of the vertices on the camera viewing volume.



Well, for those of you who want a nice looking frustum culling that is like moleys…

glMatrixMode( GL_PROJECTION );                      // Setting our PROJECTION matrix for multiplication
glGetFloatv( GL_MODELVIEW_MATRIX, frustum->modl );  // Storing MODELVIEW Matrix for multiplication

glPushMatrix();                                     // Saving the current PROJECTION matrix
glMultMatrixf( frustum->modl );                     // PROJECTION * MODELVIEW
glGetFloatv( GL_PROJECTION_MATRIX, frustum->clip ); // Our PROJECTION Matrix is our viewing volume

glMatrixMode( GL_MODELVIEW );

Tackata, multiplication is done!!!
I am making a tutorial on this, but this is how I do it in it in case you guys want to get a head start…

Miguel Castillo