View Full Version : In need: frustum culling code...
03-18-2003, 01:03 AM
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?
03-18-2003, 02:49 AM
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.
03-18-2003, 06:50 PM
i have tried the frustum culling code in gametutorials.com. 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... http://www.opengl.org/discussion_boards/ubb/smile.gif.
03-19-2003, 12:31 AM
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.
Code: http://www.markmorley.com/opengl/frustumculling.html http://rasterized.tripod.com/Articles/FrustumCulling.html
03-19-2003, 11:42 AM
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...
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.