I have an application where Im using min3d to set up the scene and camera view for me in opengl and I was able to implement raypicking but because Ill have upwards of 120 or more clickable objects in my scene the screen clicks will sometimes be off a bit and an object thats not onscreen will get the click possibly because it is just off camera.
What I would like to do is take the arraylist of objects I have in my scene and on each call of the updateScene method I would like to check a boolean value to see if the object is within the camera view or not. This would allow me to remove or add the object to another arraylist that I would iterate through when my raypicking method got called on a screen touch.
The part Im missing is how to track which objects are onscreen. I know I already have the math to get such a thing Im just a bit confused on how to implement it the right way to get objects onscreen. Any help would be awesome. Would it have something to do with tracking within the frustrum?
What you’re looking for I believe is commonly referred to as ‘frustum culling’. Basically you wrap a simple bounding box/sphere/cylinder/etc around your object, and then test this simple geometric shape against each of the planes of the frustum to see if it is fully outside of the box.
This tutorial may help you:
http://www.lighthouse3d.com/tutorials/view-frustum-culling/