UsingFrustum.cpp

00001 Propane::Math::Frustum myNewFrustum;
00002 // To initialize your frustum with whatever you have now, do this:
00003 GLfloat modelView[16];
00004 GLfloat projection[16];
00005 
00006 glGetFloatv(GL_MODELVIEW_MATRIX, modelView);
00007 glGetFloatv(GL_PROJECTION_MATRIX, projection);
00008 
00009 // In future versions of PI you will be able to use Propane::Math::getMatrix to
00010 // get and wrap the GL matrices and then use them here, which will
00011 // handle the conversion automatically.
00012 myNewFrustum.calculate(modelView, projection);
00013 
00014 // Now, to check if a sphere is in our scene, we can go
00015 if(myNewFrustum.isSphereVisible(Vector3(0,0,0), 60)) {
00016         drawSphere();
00017 }
00018 // Voila! If we can't "see" the sphere, why bother drawing it, right?

Generated on Sun Jan 14 16:49:10 2007 for Propane Injector by  doxygen 1.4.6