Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How do I perform range picking in the latest OpenGL version? By range picking I mean selecting all objects which are picked using a selection rectangle, like in an RTS game.

For single object picking I'm using the ray picking method, which I guess can be used in this case as well, but I'm not sure how I should go about doing that.

Could you give me any pointers?

Thank you.

share|improve this question
    
Can you describe how your objects are organised in memory? Do you use a scenegraph, octree, BVH or some other kind of space partitioning storage? –  Sam Hocevar Sep 17 '12 at 9:03
    
I'm not using any yet, I'm just trying to put together a simple demo which uses ray picking. –  Pateman Sep 17 '12 at 9:13
1  
Related / Duplicated: gamedev.stackexchange.com/questions/35929/… –  Dan Sep 17 '12 at 9:19
add comment

1 Answer

up vote 2 down vote accepted

Range picking is basically a set of intersection tests between objects and camera frustum (6 planes that together define a convex volume). If you have some frustum culling code, you can just fix it up to make it work. The easiest way is to generate point data from camera matrix (view*projection), adjust the point data by means of coordinate transforms and interpolation (interpolate point data on near/far planes depending on the screen-space selection rectangle corner values) and generate planes from those points.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.